]> git.lizzy.rs Git - rust.git/commitdiff
Inline `NodeIndex` methods.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 30 May 2018 06:58:48 +0000 (16:58 +1000)
committerNicholas Nethercote <nnethercote@mozilla.com>
Wed, 30 May 2018 23:22:07 +0000 (09:22 +1000)
Because they are small and hot.

src/librustc_data_structures/obligation_forest/node_index.rs

index 37512e4bcd57f334e971f44aff537f61475d2eba..d89bd22ec9637d2221b0a7cc3b7b8b05b0456776 100644 (file)
@@ -17,11 +17,13 @@ pub struct NodeIndex {
 }
 
 impl NodeIndex {
+    #[inline]
     pub fn new(value: usize) -> NodeIndex {
         assert!(value < (u32::MAX as usize));
         NodeIndex { index: NonZeroU32::new((value as u32) + 1).unwrap() }
     }
 
+    #[inline]
     pub fn get(self) -> usize {
         (self.index.get() - 1) as usize
     }