]> git.lizzy.rs Git - rust.git/commitdiff
use `Ident` in `ItemFn`
authorAndy Russell <arussell123@gmail.com>
Thu, 3 Jan 2019 19:28:20 +0000 (14:28 -0500)
committerAndy Russell <arussell123@gmail.com>
Sun, 6 Jan 2019 19:40:34 +0000 (14:40 -0500)
src/librustc/hir/intravisit.rs
src/librustc/hir/map/blocks.rs

index d4f891c874a40cc4eb31f235e76a56e016134f85..f633703be56d409106b73e1c8b9913acdd64935b 100644 (file)
 
 #[derive(Copy, Clone)]
 pub enum FnKind<'a> {
-    /// #[xxx] pub async/const/extern "Abi" fn foo()
-    ItemFn(Name, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]),
+    /// `#[xxx] pub async/const/extern "Abi" fn foo()`
+    ItemFn(Ident, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]),
 
-    /// fn foo(&self)
+    /// `fn foo(&self)`
     Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a [Attribute]),
 
-    /// |x, y| {}
+    /// `|x, y| {}`
     Closure(&'a [Attribute]),
 }
 
@@ -472,7 +472,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
             visitor.visit_nested_body(body);
         }
         ItemKind::Fn(ref declaration, header, ref generics, body_id) => {
-            visitor.visit_fn(FnKind::ItemFn(item.ident.name,
+            visitor.visit_fn(FnKind::ItemFn(item.ident,
                                             generics,
                                             header,
                                             &item.vis,
index 837a20ac0f2f02590b8cab93b62580817d7206d7..f61b8551927bbd659b680bb6ce1deee18868b914 100644 (file)
@@ -15,7 +15,7 @@
 use hir::map;
 use hir::{Expr, FnDecl, Node};
 use hir::intravisit::FnKind;
-use syntax::ast::{Attribute, Ident, Name, NodeId};
+use syntax::ast::{Attribute, Ident, NodeId};
 use syntax_pos::Span;
 
 /// An FnLikeNode is a Node that is like a fn, in that it has a decl
@@ -98,7 +98,7 @@ pub fn from_node(map: &map::Map<'a>, id: NodeId) -> Option<Code<'a>> {
 /// These are all the components one can extract from a fn item for
 /// use when implementing FnLikeNode operations.
 struct ItemFnParts<'a> {
-    name:     Name,
+    ident:    Ident,
     decl:     &'a ast::FnDecl,
     header:   ast::FnHeader,
     vis:      &'a ast::Visibility,
@@ -200,7 +200,7 @@ pub fn unsafety(self) -> ast::Unsafety {
 
     pub fn kind(self) -> FnKind<'a> {
         let item = |p: ItemFnParts<'a>| -> FnKind<'a> {
-            FnKind::ItemFn(p.name, p.generics, p.header, p.vis, p.attrs)
+            FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs)
         };
         let closure = |c: ClosureParts<'a>| {
             FnKind::Closure(c.attrs)
@@ -228,7 +228,7 @@ fn handle<A, I, M, C>(self, item_fn: I, method: M, closure: C) -> A where
                 ast::ItemKind::Fn(ref decl, header, ref generics, block) =>
                     item_fn(ItemFnParts {
                         id: i.id,
-                        name: i.ident.name,
+                        ident: i.ident,
                         decl: &decl,
                         body: block,
                         vis: &i.vis,