mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Run cargo fix
This commit is contained in:
parent
6605dbaff3
commit
171c176833
24 changed files with 44 additions and 44 deletions
|
@ -1,7 +1,7 @@
|
||||||
pub mod walk;
|
pub mod walk;
|
||||||
pub mod visit;
|
pub mod visit;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
SyntaxNodeRef, TextUnit, TextRange,
|
SyntaxNodeRef, TextUnit, TextRange,
|
||||||
text_utils::{contains_offset_nonstrict, is_subrange},
|
text_utils::{contains_offset_nonstrict, is_subrange},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use {SyntaxNodeRef, AstNode};
|
use crate::{SyntaxNodeRef, AstNode};
|
||||||
|
|
||||||
|
|
||||||
pub fn visitor<'a, T>() -> impl Visitor<'a, Output=T> {
|
pub fn visitor<'a, T>() -> impl Visitor<'a, Output=T> {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use {
|
use crate::{
|
||||||
SyntaxNodeRef,
|
SyntaxNodeRef,
|
||||||
algo::generate,
|
algo::generate,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run
|
// This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-kinds` is run
|
||||||
// Do not edit manually
|
// Do not edit manually
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
ast,
|
ast,
|
||||||
SyntaxNodeRef, AstNode,
|
SyntaxNodeRef, AstNode,
|
||||||
SyntaxKind::*,
|
SyntaxKind::*,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::marker::PhantomData;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
SmolStr, SyntaxNodeRef, SyntaxKind::*,
|
SmolStr, SyntaxNodeRef, SyntaxKind::*,
|
||||||
yellow::{RefRoot, SyntaxNodeChildren},
|
yellow::{RefRoot, SyntaxNodeChildren},
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@ mod type_args;
|
||||||
mod type_params;
|
mod type_params;
|
||||||
mod types;
|
mod types;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
token_set::TokenSet,
|
token_set::TokenSet,
|
||||||
parser_api::{Marker, CompletedMarker, Parser},
|
parser_api::{Marker, CompletedMarker, Parser},
|
||||||
SyntaxKind::{self, *},
|
SyntaxKind::{self, *},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use lexer::ptr::Ptr;
|
use crate::lexer::ptr::Ptr;
|
||||||
|
|
||||||
use SyntaxKind::{self, *};
|
use crate::SyntaxKind::{self, *};
|
||||||
|
|
||||||
pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
|
pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
|
||||||
if ptr.at_str("!/") {
|
if ptr.at_str("!/") {
|
||||||
|
|
|
@ -4,7 +4,7 @@ mod numbers;
|
||||||
mod ptr;
|
mod ptr;
|
||||||
mod strings;
|
mod strings;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
SyntaxKind::{self, *},
|
SyntaxKind::{self, *},
|
||||||
TextUnit,
|
TextUnit,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use lexer::classes::*;
|
use crate::lexer::classes::*;
|
||||||
use lexer::ptr::Ptr;
|
use crate::lexer::ptr::Ptr;
|
||||||
|
|
||||||
use SyntaxKind::{self, *};
|
use crate::SyntaxKind::{self, *};
|
||||||
|
|
||||||
pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
|
pub(crate) fn scan_number(c: char, ptr: &mut Ptr) -> SyntaxKind {
|
||||||
if c == '0' {
|
if c == '0' {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use TextUnit;
|
use crate::TextUnit;
|
||||||
|
|
||||||
use std::str::Chars;
|
use std::str::Chars;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use SyntaxKind::{self, *};
|
use crate::SyntaxKind::{self, *};
|
||||||
|
|
||||||
use lexer::ptr::Ptr;
|
use crate::lexer::ptr::Ptr;
|
||||||
|
|
||||||
pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool {
|
pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool {
|
||||||
match (c, c1, c2) {
|
match (c, c1, c2) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ mod yellow;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
pub mod text_utils;
|
pub mod text_utils;
|
||||||
|
|
||||||
pub use {
|
pub use crate::{
|
||||||
rowan::{SmolStr, TextRange, TextUnit},
|
rowan::{SmolStr, TextRange, TextUnit},
|
||||||
ast::AstNode,
|
ast::AstNode,
|
||||||
lexer::{tokenize, Token},
|
lexer::{tokenize, Token},
|
||||||
|
@ -55,7 +55,7 @@ pub use {
|
||||||
reparsing::AtomEdit,
|
reparsing::AtomEdit,
|
||||||
};
|
};
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
yellow::{GreenNode},
|
yellow::{GreenNode},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use {
|
use crate::{
|
||||||
token_set::TokenSet,
|
token_set::TokenSet,
|
||||||
parser_impl::ParserImpl,
|
parser_impl::ParserImpl,
|
||||||
SyntaxKind::{self, ERROR},
|
SyntaxKind::{self, ERROR},
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//! `start node`, `finish node`, and `FileBuilder` converts
|
//! `start node`, `finish node`, and `FileBuilder` converts
|
||||||
//! this stream to a real tree.
|
//! this stream to a real tree.
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use {
|
use crate::{
|
||||||
TextUnit, TextRange, SmolStr,
|
TextUnit, TextRange, SmolStr,
|
||||||
lexer::Token,
|
lexer::Token,
|
||||||
parser_impl::Sink,
|
parser_impl::Sink,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use {lexer::Token, SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit};
|
use crate::{lexer::Token, SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit};
|
||||||
|
|
||||||
use std::ops::{Add, AddAssign};
|
use std::ops::{Add, AddAssign};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ mod input;
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
TextUnit, SmolStr,
|
TextUnit, SmolStr,
|
||||||
lexer::Token,
|
lexer::Token,
|
||||||
parser_api::Parser,
|
parser_api::Parser,
|
||||||
|
@ -13,7 +13,7 @@ use {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use SyntaxKind::{self, EOF, TOMBSTONE};
|
use crate::SyntaxKind::{self, EOF, TOMBSTONE};
|
||||||
|
|
||||||
pub(crate) trait Sink {
|
pub(crate) trait Sink {
|
||||||
type Tree;
|
type Tree;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
use algo;
|
use crate::algo;
|
||||||
use grammar;
|
use crate::grammar;
|
||||||
use lexer::{tokenize, Token};
|
use crate::lexer::{tokenize, Token};
|
||||||
use yellow::{self, GreenNode, SyntaxNodeRef, SyntaxError};
|
use crate::yellow::{self, GreenNode, SyntaxNodeRef, SyntaxError};
|
||||||
use parser_impl;
|
use crate::parser_impl;
|
||||||
use parser_api::Parser;
|
use crate::parser_api::Parser;
|
||||||
use {
|
use crate::{
|
||||||
TextUnit, TextRange,
|
TextUnit, TextRange,
|
||||||
SyntaxKind::*,
|
SyntaxKind::*,
|
||||||
};
|
};
|
||||||
use text_utils::replace_range;
|
use crate::text_utils::replace_range;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AtomEdit {
|
pub struct AtomEdit {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
mod generated;
|
mod generated;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use SyntaxKind::*;
|
use crate::SyntaxKind::*;
|
||||||
|
|
||||||
pub use self::generated::SyntaxKind;
|
pub use self::generated::SyntaxKind;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use {TextRange, TextUnit};
|
use crate::{TextRange, TextUnit};
|
||||||
|
|
||||||
pub fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool {
|
pub fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool {
|
||||||
range.start() <= offset && offset <= range.end()
|
range.start() <= offset && offset <= range.end()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use SyntaxKind;
|
use crate::SyntaxKind;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub(crate) struct TokenSet(pub(crate) u128);
|
pub(crate) struct TokenSet(pub(crate) u128);
|
||||||
|
@ -29,7 +29,7 @@ macro_rules! token_set_union {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn token_set_works_for_tokens() {
|
fn token_set_works_for_tokens() {
|
||||||
use SyntaxKind::*;
|
use crate::SyntaxKind::*;
|
||||||
let ts = token_set! { EOF, SHEBANG };
|
let ts = token_set! { EOF, SHEBANG };
|
||||||
assert!(ts.contains(EOF));
|
assert!(ts.contains(EOF));
|
||||||
assert!(ts.contains(SHEBANG));
|
assert!(ts.contains(SHEBANG));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use {
|
use crate::{
|
||||||
algo::walk::{walk, WalkEvent},
|
algo::walk::{walk, WalkEvent},
|
||||||
SyntaxKind, File, SyntaxNodeRef
|
SyntaxKind, File, SyntaxNodeRef
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use rowan::GreenNodeBuilder;
|
use rowan::GreenNodeBuilder;
|
||||||
use {
|
use crate::{
|
||||||
TextUnit, SmolStr,
|
TextUnit, SmolStr,
|
||||||
parser_impl::Sink,
|
parser_impl::Sink,
|
||||||
yellow::{GreenNode, SyntaxError, RaTypes},
|
yellow::{GreenNode, SyntaxError, RaTypes},
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::{
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
};
|
};
|
||||||
use rowan::Types;
|
use rowan::Types;
|
||||||
use {SyntaxKind, TextUnit, TextRange, SmolStr};
|
use crate::{SyntaxKind, TextUnit, TextRange, SmolStr};
|
||||||
use self::syntax_text::SyntaxText;
|
use self::syntax_text::SyntaxText;
|
||||||
|
|
||||||
pub use rowan::{TreeRoot};
|
pub use rowan::{TreeRoot};
|
||||||
|
@ -70,16 +70,16 @@ impl<'a> SyntaxNodeRef<'a> {
|
||||||
self.0.leaf_text()
|
self.0.leaf_text()
|
||||||
}
|
}
|
||||||
pub fn ancestors(self) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
pub fn ancestors(self) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
||||||
::algo::generate(Some(self), |&node| node.parent())
|
crate::algo::generate(Some(self), |&node| node.parent())
|
||||||
}
|
}
|
||||||
pub fn descendants(self) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
pub fn descendants(self) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
||||||
::algo::walk::walk(self).filter_map(|event| match event {
|
crate::algo::walk::walk(self).filter_map(|event| match event {
|
||||||
::algo::walk::WalkEvent::Enter(node) => Some(node),
|
crate::algo::walk::WalkEvent::Enter(node) => Some(node),
|
||||||
::algo::walk::WalkEvent::Exit(_) => None,
|
crate::algo::walk::WalkEvent::Exit(_) => None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn siblings(self, direction: Direction) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
pub fn siblings(self, direction: Direction) -> impl Iterator<Item=SyntaxNodeRef<'a>> {
|
||||||
::algo::generate(Some(self), move |&node| match direction {
|
crate::algo::generate(Some(self), move |&node| match direction {
|
||||||
Direction::Next => node.next_sibling(),
|
Direction::Next => node.next_sibling(),
|
||||||
Direction::Prev => node.prev_sibling(),
|
Direction::Prev => node.prev_sibling(),
|
||||||
})
|
})
|
||||||
|
@ -156,7 +156,7 @@ impl<R: TreeRoot<RaTypes>> Iterator for SyntaxNodeChildren<R> {
|
||||||
|
|
||||||
|
|
||||||
fn has_short_text(kind: SyntaxKind) -> bool {
|
fn has_short_text(kind: SyntaxKind) -> bool {
|
||||||
use SyntaxKind::*;
|
use crate::SyntaxKind::*;
|
||||||
match kind {
|
match kind {
|
||||||
IDENT | LIFETIME | INT_NUMBER | FLOAT_NUMBER => true,
|
IDENT | LIFETIME | INT_NUMBER | FLOAT_NUMBER => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::{
|
||||||
fmt, ops,
|
fmt, ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
SyntaxNodeRef, TextRange, TextUnit,
|
SyntaxNodeRef, TextRange, TextUnit,
|
||||||
text_utils::{intersect, contains_offset_nonstrict},
|
text_utils::{intersect, contains_offset_nonstrict},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue