mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Cargo Format
Run `cargo fmt` and ignore generated files
This commit is contained in:
parent
39cb6c6d3f
commit
61f3a438d3
76 changed files with 1936 additions and 1530 deletions
|
@ -1,6 +1,8 @@
|
|||
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run
|
||||
// Do not edit manually
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
use crate::{
|
||||
ast,
|
||||
SyntaxNodeRef, AstNode,
|
||||
|
|
|
@ -3,6 +3,8 @@ the below applies to the result of this template
|
|||
#}// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run
|
||||
// Do not edit manually
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
|
||||
use crate::{
|
||||
ast,
|
||||
SyntaxNodeRef, AstNode,
|
||||
|
|
|
@ -4,15 +4,18 @@ use std::marker::PhantomData;
|
|||
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::{
|
||||
SmolStr, SyntaxNodeRef, SyntaxKind::*,
|
||||
yellow::{RefRoot, SyntaxNodeChildren},
|
||||
};
|
||||
pub use self::generated::*;
|
||||
use crate::{
|
||||
yellow::{RefRoot, SyntaxNodeChildren},
|
||||
SmolStr,
|
||||
SyntaxKind::*,
|
||||
SyntaxNodeRef,
|
||||
};
|
||||
|
||||
pub trait AstNode<'a>: Clone + Copy + 'a {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self>
|
||||
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<RefRoot<'a>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue