]> git.lizzy.rs Git - rust.git/commitdiff
Inline `Span` methods.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 9 May 2018 05:25:44 +0000 (15:25 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Wed, 9 May 2018 10:14:03 +0000 (20:14 +1000)
Because they are simple and hot.

This change speeds up some incremental runs of a few rustc-perf
benchmarks, the best by 3%.

src/libsyntax_pos/span_encoding.rs

index b55fe4bcb26721ad8f913adbb441a9ade7294cc1..601a0273ae91178efa1b52a9c58321a1ea397d7c 100644 (file)
 
 impl Copy for Span {}
 impl Clone for Span {
+    #[inline]
     fn clone(&self) -> Span {
         *self
     }
 }
 impl PartialEq for Span {
+    #[inline]
     fn eq(&self, other: &Span) -> bool {
         let a = self.0;
         let b = other.0;
@@ -44,6 +46,7 @@ fn eq(&self, other: &Span) -> bool {
 }
 impl Eq for Span {}
 impl Hash for Span {
+    #[inline]
     fn hash<H: Hasher>(&self, state: &mut H) {
         let a = self.0;
         a.hash(state)