]> git.lizzy.rs Git - rust.git/commitdiff
Fix review nits
authorbobtwinkles <srkoser+GitHub@gmail.com>
Thu, 26 Apr 2018 22:28:34 +0000 (18:28 -0400)
committerbobtwinkles <srkoser+GitHub@gmail.com>
Thu, 26 Apr 2018 22:28:34 +0000 (18:28 -0400)
src/libproc_macro/lib.rs
src/libsyntax_pos/hygiene.rs
src/libsyntax_pos/lib.rs

index 4d24353a383d10f1b916c74469501406745b5824..f51dbc3772f06ee1c3302304fe69f802b653c2e3 100644 (file)
@@ -270,7 +270,7 @@ pub fn source_file(&self) -> SourceFile {
     /// `self` was generated from, if any.
     #[unstable(feature = "proc_macro", issue = "38356")]
     pub fn parent(&self) -> Option<Span> {
-        self.0.parent().map(|x| { Span(x) })
+        self.0.parent().map(Span)
     }
 
     /// The span for the origin source code that `self` was generated from. If
index 8e9564d0ac1918ec2a18f9079c2645dab93fef07..658408519b9c7ead442eb045feb90ac82e258f1a 100644 (file)
@@ -123,11 +123,11 @@ pub fn is_descendant_of(mut self, ancestor: Mark) -> bool {
     /// mark. That is, the following holds:
     ///
     /// ```rust
-    /// let lub = lub(a, b);
-    /// assert!(a.is_descendant_of(lub))
-    /// assert!(b.is_descendant_of(lub))
+    /// let la = least_ancestor(a, b);
+    /// assert!(a.is_descendant_of(la))
+    /// assert!(b.is_descendant_of(la))
     /// ```
-    pub fn lub(mut a: Mark, mut b: Mark) -> Mark {
+    pub fn least_ancestor(mut a: Mark, mut b: Mark) -> Mark {
         HygieneData::with(|data| {
             // Compute the path from a to the root
             let mut a_path = FxHashSet::<Mark>();
@@ -138,7 +138,7 @@ pub fn lub(mut a: Mark, mut b: Mark) -> Mark {
 
             // While the path from b to the root hasn't intersected, move up the tree
             while !a_path.contains(&b) {
-                b =  data.marks[b.0 as usize].parent;
+                b = data.marks[b.0 as usize].parent;
             }
 
             b
index 19f52d83a0176f7d0d12764c2d94bac86de842ae..8d37b4aa3968f5c84deaa5cd3383eb13ba21e4d2 100644 (file)
@@ -291,7 +291,7 @@ pub fn source_callsite(self) -> Span {
         self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
     }
 
-    /// The `Span for the tokens in the previous macro expansion from which `self` was generated,
+    /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
     /// if any
     pub fn parent(self) -> Option<Span> {
         self.ctxt().outer().expn_info().map(|i| i.call_site)