From 61f3a438d3a729a6be941bca1ff4c6a97a33f221 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Mon, 15 Oct 2018 17:44:23 -0400 Subject: Cargo Format Run `cargo fmt` and ignore generated files --- crates/ra_syntax/src/ast/mod.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'crates/ra_syntax/src/ast/mod.rs') diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs index 88193a1ed..34958b6cb 100644 --- a/crates/ra_syntax/src/ast/mod.rs +++ b/crates/ra_syntax/src/ast/mod.rs @@ -4,15 +4,18 @@ use std::marker::PhantomData; use itertools::Itertools; +pub use self::generated::*; use crate::{ - SmolStr, SyntaxNodeRef, SyntaxKind::*, yellow::{RefRoot, SyntaxNodeChildren}, + SmolStr, + SyntaxKind::*, + SyntaxNodeRef, }; -pub use self::generated::*; pub trait AstNode<'a>: Clone + Copy + 'a { fn cast(syntax: SyntaxNodeRef<'a>) -> Option - where Self: Sized; + where + Self: Sized; fn syntax(self) -> SyntaxNodeRef<'a>; } @@ -64,9 +67,7 @@ pub trait AttrsOwner<'a>: AstNode<'a> { impl<'a> FnDef<'a> { pub fn has_atom_attr(&self, atom: &str) -> bool { - self.attrs() - .filter_map(|x| x.as_atom()) - .any(|x| x == atom) + self.attrs().filter_map(|x| x.as_atom()).any(|x| x == atom) } } @@ -135,7 +136,7 @@ pub enum CommentFlavor { Line, Doc, ModuleDoc, - Multiline + Multiline, } impl CommentFlavor { @@ -145,7 +146,7 @@ impl CommentFlavor { Line => "//", Doc => "///", ModuleDoc => "//!", - Multiline => "/*" + Multiline => "/*", } } } @@ -166,16 +167,14 @@ impl<'a> Whitespace<'a> { impl<'a> Name<'a> { pub fn text(&self) -> SmolStr { - let ident = self.syntax().first_child() - .unwrap(); + let ident = self.syntax().first_child().unwrap(); ident.leaf_text().unwrap().clone() } } impl<'a> NameRef<'a> { pub fn text(&self) -> SmolStr { - let ident = self.syntax().first_child() - .unwrap(); + let ident = self.syntax().first_child().unwrap(); ident.leaf_text().unwrap().clone() } } @@ -241,7 +240,6 @@ fn children<'a, P: AstNode<'a>, C: AstNode<'a>>(parent: P) -> AstChildren<'a, C> AstChildren::new(parent.syntax()) } - #[derive(Debug)] pub struct AstChildren<'a, N> { inner: SyntaxNodeChildren>, -- cgit v1.2.3