@@ -246,6 +246,7 @@ impl Hir {
246246 /// Returns an empty HIR expression.
247247 ///
248248 /// An empty HIR expression always matches, including the empty string.
249+ #[ inline]
249250 pub fn empty ( ) -> Hir {
250251 let props = Properties :: empty ( ) ;
251252 Hir { kind : HirKind :: Empty , props }
@@ -265,6 +266,7 @@ impl Hir {
265266 /// because empty character classes can be spelled in the concrete syntax
266267 /// of a regex (e.g., `\P{any}` or `(?-u:[^\x00-\xFF])` or `[a&&b]`), but
267268 /// empty alternations cannot.
269+ #[ inline]
268270 pub fn fail ( ) -> Hir {
269271 let class = Class :: Bytes ( ClassBytes :: empty ( ) ) ;
270272 let props = Properties :: class ( & class) ;
@@ -279,6 +281,7 @@ impl Hir {
279281 /// If the given literal has a `Byte` variant with an ASCII byte, then this
280282 /// method panics. This enforces the invariant that `Byte` variants are
281283 /// only used to express matching of invalid UTF-8.
284+ #[ inline]
282285 pub fn literal < B : Into < Box < [ u8 ] > > > ( lit : B ) -> Hir {
283286 let bytes = lit. into ( ) ;
284287 if bytes. is_empty ( ) {
@@ -291,6 +294,7 @@ impl Hir {
291294 }
292295
293296 /// Creates a class HIR expression.
297+ #[ inline]
294298 pub fn class ( class : Class ) -> Hir {
295299 if class. is_empty ( ) {
296300 return Hir :: fail ( ) ;
@@ -302,12 +306,14 @@ impl Hir {
302306 }
303307
304308 /// Creates a look-around assertion HIR expression.
309+ #[ inline]
305310 pub fn look ( look : Look ) -> Hir {
306311 let props = Properties :: look ( look) ;
307312 Hir { kind : HirKind :: Look ( look) , props }
308313 }
309314
310315 /// Creates a repetition HIR expression.
316+ #[ inline]
311317 pub fn repetition ( rep : Repetition ) -> Hir {
312318 // The regex 'a{0}' is always equivalent to the empty regex. This is
313319 // true even when 'a' is an expression that never matches anything
@@ -324,6 +330,7 @@ impl Hir {
324330 }
325331
326332 /// Creates a group HIR expression.
333+ #[ inline]
327334 pub fn group ( group : Group ) -> Hir {
328335 let props = Properties :: group ( & group) ;
329336 Hir { kind : HirKind :: Group ( group) , props }
@@ -375,6 +382,8 @@ impl Hir {
375382 }
376383 }
377384 }
385+ // We can just skip empty HIRs.
386+ HirKind :: Empty => { }
378387 kind => {
379388 if let Some ( prior_bytes) = prior_lit. take ( ) {
380389 new. push ( Hir :: literal ( prior_bytes) ) ;
@@ -452,6 +461,7 @@ impl Hir {
452461 /// Note that this is a convenience routine for constructing the correct
453462 /// character class based on the value of `Dot`. There is no explicit "dot"
454463 /// HIR value. It is just an abbreviation for a common character class.
464+ #[ inline]
455465 pub fn dot ( dot : Dot ) -> Hir {
456466 match dot {
457467 Dot :: AnyChar => {
0 commit comments