@@ -246,6 +246,7 @@ impl Hir {
246
246
/// Returns an empty HIR expression.
247
247
///
248
248
/// An empty HIR expression always matches, including the empty string.
249
+ #[ inline]
249
250
pub fn empty ( ) -> Hir {
250
251
let props = Properties :: empty ( ) ;
251
252
Hir { kind : HirKind :: Empty , props }
@@ -265,6 +266,7 @@ impl Hir {
265
266
/// because empty character classes can be spelled in the concrete syntax
266
267
/// of a regex (e.g., `\P{any}` or `(?-u:[^\x00-\xFF])` or `[a&&b]`), but
267
268
/// empty alternations cannot.
269
+ #[ inline]
268
270
pub fn fail ( ) -> Hir {
269
271
let class = Class :: Bytes ( ClassBytes :: empty ( ) ) ;
270
272
let props = Properties :: class ( & class) ;
@@ -279,6 +281,7 @@ impl Hir {
279
281
/// If the given literal has a `Byte` variant with an ASCII byte, then this
280
282
/// method panics. This enforces the invariant that `Byte` variants are
281
283
/// only used to express matching of invalid UTF-8.
284
+ #[ inline]
282
285
pub fn literal < B : Into < Box < [ u8 ] > > > ( lit : B ) -> Hir {
283
286
let bytes = lit. into ( ) ;
284
287
if bytes. is_empty ( ) {
@@ -291,6 +294,7 @@ impl Hir {
291
294
}
292
295
293
296
/// Creates a class HIR expression.
297
+ #[ inline]
294
298
pub fn class ( class : Class ) -> Hir {
295
299
if class. is_empty ( ) {
296
300
return Hir :: fail ( ) ;
@@ -302,12 +306,14 @@ impl Hir {
302
306
}
303
307
304
308
/// Creates a look-around assertion HIR expression.
309
+ #[ inline]
305
310
pub fn look ( look : Look ) -> Hir {
306
311
let props = Properties :: look ( look) ;
307
312
Hir { kind : HirKind :: Look ( look) , props }
308
313
}
309
314
310
315
/// Creates a repetition HIR expression.
316
+ #[ inline]
311
317
pub fn repetition ( rep : Repetition ) -> Hir {
312
318
// The regex 'a{0}' is always equivalent to the empty regex. This is
313
319
// true even when 'a' is an expression that never matches anything
@@ -324,6 +330,7 @@ impl Hir {
324
330
}
325
331
326
332
/// Creates a group HIR expression.
333
+ #[ inline]
327
334
pub fn group ( group : Group ) -> Hir {
328
335
let props = Properties :: group ( & group) ;
329
336
Hir { kind : HirKind :: Group ( group) , props }
@@ -375,6 +382,8 @@ impl Hir {
375
382
}
376
383
}
377
384
}
385
+ // We can just skip empty HIRs.
386
+ HirKind :: Empty => { }
378
387
kind => {
379
388
if let Some ( prior_bytes) = prior_lit. take ( ) {
380
389
new. push ( Hir :: literal ( prior_bytes) ) ;
@@ -452,6 +461,7 @@ impl Hir {
452
461
/// Note that this is a convenience routine for constructing the correct
453
462
/// character class based on the value of `Dot`. There is no explicit "dot"
454
463
/// HIR value. It is just an abbreviation for a common character class.
464
+ #[ inline]
455
465
pub fn dot ( dot : Dot ) -> Hir {
456
466
match dot {
457
467
Dot :: AnyChar => {
0 commit comments