mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-21 15:51:46 +00:00
cargo fmt
This commit is contained in:
parent
87f837cec7
commit
7535bb4661
571 changed files with 2210 additions and 2458 deletions
|
@ -3,8 +3,8 @@
|
|||
use itertools::Itertools;
|
||||
|
||||
use crate::{
|
||||
syntax_editor::Element, AstNode, Direction, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode,
|
||||
SyntaxToken, TextRange, TextSize,
|
||||
AstNode, Direction, NodeOrToken, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange,
|
||||
TextSize, syntax_editor::Element,
|
||||
};
|
||||
|
||||
/// Returns ancestors of the node at the offset, sorted by length. This should
|
||||
|
|
|
@ -17,8 +17,8 @@ use std::marker::PhantomData;
|
|||
use either::Either;
|
||||
|
||||
use crate::{
|
||||
syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken},
|
||||
SyntaxKind,
|
||||
syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken},
|
||||
};
|
||||
|
||||
pub use self::{
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
use std::{fmt, iter, ops};
|
||||
|
||||
use crate::{
|
||||
ast::{self, make, AstNode},
|
||||
ted, AstToken, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
|
||||
AstToken, NodeOrToken, SyntaxElement, SyntaxNode, SyntaxToken,
|
||||
ast::{self, AstNode, make},
|
||||
ted,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
|
|
@ -5,12 +5,12 @@ use std::iter::{empty, once, successors};
|
|||
use parser::{SyntaxKind, T};
|
||||
|
||||
use crate::{
|
||||
algo::{self, neighbor},
|
||||
ast::{self, edit::IndentLevel, make, HasGenericArgs, HasGenericParams},
|
||||
ted::{self, Position},
|
||||
AstNode, AstToken, Direction, SyntaxElement,
|
||||
SyntaxKind::{ATTR, COMMENT, WHITESPACE},
|
||||
SyntaxNode, SyntaxToken,
|
||||
algo::{self, neighbor},
|
||||
ast::{self, HasGenericArgs, HasGenericParams, edit::IndentLevel, make},
|
||||
ted::{self, Position},
|
||||
};
|
||||
|
||||
use super::{GenericParam, HasArgList, HasName};
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
//! These methods should only do simple, shallow tasks related to the syntax of the node itself.
|
||||
|
||||
use crate::{
|
||||
ast::{
|
||||
self,
|
||||
operators::{ArithOp, BinaryOp, CmpOp, LogicOp, Ordering, RangeOp, UnaryOp},
|
||||
support, ArgList, AstChildren, AstNode, BlockExpr, ClosureExpr, Const, Expr, Fn,
|
||||
FormatArgsArg, FormatArgsExpr, MacroDef, Static, TokenTree,
|
||||
},
|
||||
AstToken,
|
||||
SyntaxKind::{self, *},
|
||||
SyntaxNode, SyntaxToken, T,
|
||||
ast::{
|
||||
self, ArgList, AstChildren, AstNode, BlockExpr, ClosureExpr, Const, Expr, Fn,
|
||||
FormatArgsArg, FormatArgsExpr, MacroDef, Static, TokenTree,
|
||||
operators::{ArithOp, BinaryOp, CmpOp, LogicOp, Ordering, RangeOp, UnaryOp},
|
||||
support,
|
||||
},
|
||||
};
|
||||
|
||||
use super::RangeItem;
|
||||
|
|
|
@ -19,9 +19,9 @@ use rowan::NodeOrToken;
|
|||
use stdx::{format_to, format_to_acc, never};
|
||||
|
||||
use crate::{
|
||||
ast::{self, make::quote::quote, Param},
|
||||
utils::is_raw_identifier,
|
||||
AstNode, SourceFile, SyntaxKind, SyntaxToken,
|
||||
ast::{self, Param, make::quote::quote},
|
||||
utils::is_raw_identifier,
|
||||
};
|
||||
|
||||
/// While the parent module defines basic atomic "constructors", the `ext`
|
||||
|
@ -131,11 +131,7 @@ pub fn name_ref(name_ref: &str) -> ast::NameRef {
|
|||
}
|
||||
}
|
||||
fn raw_ident_esc(ident: &str) -> &'static str {
|
||||
if is_raw_identifier(ident, Edition::CURRENT) {
|
||||
"r#"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
if is_raw_identifier(ident, Edition::CURRENT) { "r#" } else { "" }
|
||||
}
|
||||
|
||||
pub fn lifetime(text: &str) -> ast::Lifetime {
|
||||
|
@ -328,7 +324,9 @@ pub fn impl_trait(
|
|||
None => String::new(),
|
||||
};
|
||||
|
||||
ast_from_text(&format!("{is_unsafe}impl{gen_params} {is_negative}{path_type}{trait_gen_args} for {ty}{type_gen_args}{where_clause}{{{body_newline}{body}}}"))
|
||||
ast_from_text(&format!(
|
||||
"{is_unsafe}impl{gen_params} {is_negative}{path_type}{trait_gen_args} for {ty}{type_gen_args}{where_clause}{{{body_newline}{body}}}"
|
||||
))
|
||||
}
|
||||
|
||||
pub fn impl_trait_type(bounds: ast::TypeBoundList) -> ast::ImplTraitType {
|
||||
|
@ -1274,11 +1272,12 @@ pub mod tokens {
|
|||
|
||||
use parser::Edition;
|
||||
|
||||
use crate::{ast, AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken};
|
||||
use crate::{AstNode, Parse, SourceFile, SyntaxKind::*, SyntaxToken, ast};
|
||||
|
||||
pub(super) static SOURCE_FILE: LazyLock<Parse<SourceFile>> = LazyLock::new(|| {
|
||||
SourceFile::parse(
|
||||
"use crate::foo; const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, async { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
|
||||
"use crate::foo; const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, async { let _ @ [] })\n;\n\nimpl A for B where: {}",
|
||||
Edition::CURRENT,
|
||||
)
|
||||
});
|
||||
|
||||
|
|
|
@ -10,11 +10,12 @@ use parser::SyntaxKind;
|
|||
use rowan::{GreenNodeData, GreenTokenData};
|
||||
|
||||
use crate::{
|
||||
NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, T, TokenText,
|
||||
ast::{
|
||||
self, support, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName,
|
||||
SyntaxNode,
|
||||
self, AstNode, AstToken, HasAttrs, HasGenericArgs, HasGenericParams, HasName, SyntaxNode,
|
||||
support,
|
||||
},
|
||||
ted, NodeOrToken, SmolStr, SyntaxElement, SyntaxToken, TokenText, T,
|
||||
ted,
|
||||
};
|
||||
|
||||
use super::{GenericParam, RangeItem, RangeOp};
|
||||
|
@ -317,11 +318,7 @@ impl ast::Path {
|
|||
let path_range = self.syntax().text_range();
|
||||
successors(self.first_segment(), move |p| {
|
||||
p.parent_path().parent_path().and_then(|p| {
|
||||
if path_range.contains_range(p.syntax().text_range()) {
|
||||
p.segment()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if path_range.contains_range(p.syntax().text_range()) { p.segment() } else { None }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -506,11 +503,7 @@ impl ast::Union {
|
|||
impl ast::RecordExprField {
|
||||
pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordExprField> {
|
||||
let candidate = Self::for_name_ref(field_name)?;
|
||||
if candidate.field_name().as_ref() == Some(field_name) {
|
||||
Some(candidate)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if candidate.field_name().as_ref() == Some(field_name) { Some(candidate) } else { None }
|
||||
}
|
||||
|
||||
pub fn for_name_ref(name_ref: &ast::NameRef) -> Option<ast::RecordExprField> {
|
||||
|
@ -785,11 +778,7 @@ pub enum SelfParamKind {
|
|||
impl ast::SelfParam {
|
||||
pub fn kind(&self) -> SelfParamKind {
|
||||
if self.amp_token().is_some() {
|
||||
if self.mut_token().is_some() {
|
||||
SelfParamKind::MutRef
|
||||
} else {
|
||||
SelfParamKind::Ref
|
||||
}
|
||||
if self.mut_token().is_some() { SelfParamKind::MutRef } else { SelfParamKind::Ref }
|
||||
} else {
|
||||
SelfParamKind::Owned
|
||||
}
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
use stdx::always;
|
||||
|
||||
use crate::{
|
||||
AstNode, SyntaxNode,
|
||||
ast::{self, BinaryOp, Expr, HasArgList, RangeItem},
|
||||
match_ast, AstNode, SyntaxNode,
|
||||
match_ast,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
||||
|
@ -283,7 +284,7 @@ impl Expr {
|
|||
.map(|op| matches!(op, BinaryOp::LogicOp(_)))
|
||||
.unwrap_or(false) =>
|
||||
{
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
_ if self.clone().trailing_brace().is_some() => return true,
|
||||
_ => {}
|
||||
|
@ -446,8 +447,8 @@ impl Expr {
|
|||
}
|
||||
|
||||
fn is_ordered_before_parent_in_place_of(&self, parent: &Expr, place_of: &SyntaxNode) -> bool {
|
||||
use rowan::TextSize;
|
||||
use Expr::*;
|
||||
use rowan::TextSize;
|
||||
|
||||
let self_range = self.syntax().text_range();
|
||||
let place_of_range = place_of.text_range();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//! Wrappers over [`make`] constructors
|
||||
use crate::{
|
||||
AstNode, NodeOrToken, SyntaxKind, SyntaxNode, SyntaxToken,
|
||||
ast::{
|
||||
self, make, HasArgList, HasGenericArgs, HasGenericParams, HasLoopBody, HasName,
|
||||
HasTypeBounds, HasVisibility,
|
||||
self, HasArgList, HasGenericArgs, HasGenericParams, HasLoopBody, HasName, HasTypeBounds,
|
||||
HasVisibility, make,
|
||||
},
|
||||
syntax_editor::SyntaxMappingBuilder,
|
||||
AstNode, NodeOrToken, SyntaxKind, SyntaxNode, SyntaxToken,
|
||||
};
|
||||
|
||||
use super::SyntaxFactory;
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
use std::{borrow::Cow, num::ParseIntError};
|
||||
|
||||
use rustc_lexer::unescape::{
|
||||
unescape_byte, unescape_char, unescape_mixed, unescape_unicode, EscapeError, MixedUnit, Mode,
|
||||
EscapeError, MixedUnit, Mode, unescape_byte, unescape_char, unescape_mixed, unescape_unicode,
|
||||
};
|
||||
use stdx::always;
|
||||
|
||||
use crate::{
|
||||
ast::{self, AstToken},
|
||||
TextRange, TextSize,
|
||||
ast::{self, AstToken},
|
||||
};
|
||||
|
||||
impl ast::Comment {
|
||||
|
@ -383,11 +383,7 @@ impl ast::IntNumber {
|
|||
|
||||
pub fn suffix(&self) -> Option<&str> {
|
||||
let (_, _, suffix) = self.split_into_parts();
|
||||
if suffix.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(suffix)
|
||||
}
|
||||
if suffix.is_empty() { None } else { Some(suffix) }
|
||||
}
|
||||
|
||||
pub fn value_string(&self) -> String {
|
||||
|
@ -422,11 +418,7 @@ impl ast::FloatNumber {
|
|||
|
||||
pub fn suffix(&self) -> Option<&str> {
|
||||
let (_, suffix) = self.split_into_parts();
|
||||
if suffix.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(suffix)
|
||||
}
|
||||
if suffix.is_empty() { None } else { Some(suffix) }
|
||||
}
|
||||
|
||||
pub fn value_string(&self) -> String {
|
||||
|
@ -491,7 +483,7 @@ impl ast::Byte {
|
|||
mod tests {
|
||||
use rustc_apfloat::ieee::Quad as f128;
|
||||
|
||||
use crate::ast::{self, make, FloatNumber, IntNumber};
|
||||
use crate::ast::{self, FloatNumber, IntNumber, make};
|
||||
|
||||
fn check_float_suffix<'a>(lit: &str, expected: impl Into<Option<&'a str>>) {
|
||||
assert_eq!(FloatNumber { syntax: make::tokens::literal(lit) }.suffix(), expected.into());
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
use either::Either;
|
||||
|
||||
use crate::{
|
||||
ast::{self, support, AstChildren, AstNode, AstToken},
|
||||
syntax_node::SyntaxElementChildren,
|
||||
SyntaxElement, SyntaxToken, T,
|
||||
ast::{self, AstChildren, AstNode, AstToken, support},
|
||||
syntax_node::SyntaxElementChildren,
|
||||
};
|
||||
|
||||
pub trait HasName: AstNode {
|
||||
|
@ -121,11 +121,7 @@ impl DocCommentIter {
|
|||
&mut self.filter_map(|comment| comment.doc_comment().map(ToOwned::to_owned)),
|
||||
"\n",
|
||||
);
|
||||
if docs.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(docs)
|
||||
}
|
||||
if docs.is_empty() { None } else { Some(docs) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::str::{self, FromStr};
|
|||
|
||||
use parser::Edition;
|
||||
|
||||
use crate::{validation, AstNode, SourceFile, TextRange};
|
||||
use crate::{AstNode, SourceFile, TextRange, validation};
|
||||
|
||||
fn check_file_invariants(file: &SourceFile) {
|
||||
let root = file.syntax();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use parser::Edition;
|
||||
|
||||
use crate::{ast, AstNode};
|
||||
use crate::{AstNode, ast};
|
||||
|
||||
pub fn parse_expr_from_str(s: &str, edition: Edition) -> Option<ast::Expr> {
|
||||
let s = s.trim();
|
||||
|
|
|
@ -61,11 +61,11 @@ pub use crate::{
|
|||
};
|
||||
pub use parser::{Edition, SyntaxKind, T};
|
||||
pub use rowan::{
|
||||
api::Preorder, Direction, GreenNode, NodeOrToken, SyntaxText, TextRange, TextSize,
|
||||
TokenAtOffset, WalkEvent,
|
||||
Direction, GreenNode, NodeOrToken, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent,
|
||||
api::Preorder,
|
||||
};
|
||||
pub use rustc_lexer::unescape;
|
||||
pub use smol_str::{format_smolstr, SmolStr, SmolStrBuilder, ToSmolStr};
|
||||
pub use smol_str::{SmolStr, SmolStrBuilder, ToSmolStr, format_smolstr};
|
||||
|
||||
/// `Parse` is the result of the parsing: a syntax tree and a collection of
|
||||
/// errors.
|
||||
|
|
|
@ -5,7 +5,7 @@ mod reparsing;
|
|||
|
||||
use rowan::TextRange;
|
||||
|
||||
use crate::{syntax_node::GreenNode, SyntaxError, SyntaxTreeBuilder};
|
||||
use crate::{SyntaxError, SyntaxTreeBuilder, syntax_node::GreenNode};
|
||||
|
||||
pub(crate) use crate::parsing::reparsing::incremental_reparse;
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ use std::ops::Range;
|
|||
use parser::{Edition, Reparser};
|
||||
|
||||
use crate::{
|
||||
parsing::build_tree,
|
||||
syntax_node::{GreenNode, GreenToken, NodeOrToken, SyntaxElement, SyntaxNode},
|
||||
SyntaxError,
|
||||
SyntaxKind::*,
|
||||
TextRange, TextSize, T,
|
||||
T, TextRange, TextSize,
|
||||
parsing::build_tree,
|
||||
syntax_node::{GreenNode, GreenToken, NodeOrToken, SyntaxElement, SyntaxNode},
|
||||
};
|
||||
|
||||
pub(crate) fn incremental_reparse(
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::{
|
|||
|
||||
use rowan::TextRange;
|
||||
|
||||
use crate::{syntax_node::RustLanguage, AstNode, SyntaxNode};
|
||||
use crate::{AstNode, SyntaxNode, syntax_node::RustLanguage};
|
||||
|
||||
/// A "pointer" to a [`SyntaxNode`], via location in the source code.
|
||||
pub type SyntaxNodePtr = rowan::ast::SyntaxNodePtr<RustLanguage>;
|
||||
|
@ -118,7 +118,7 @@ impl<N: AstNode> From<AstPtr<N>> for SyntaxNodePtr {
|
|||
|
||||
#[test]
|
||||
fn test_local_syntax_ptr() {
|
||||
use crate::{ast, AstNode, SourceFile};
|
||||
use crate::{AstNode, SourceFile, ast};
|
||||
|
||||
let file = SourceFile::parse("struct Foo { f: u32, }", parser::Edition::CURRENT).ok().unwrap();
|
||||
let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap();
|
||||
|
|
|
@ -385,8 +385,8 @@ mod tests {
|
|||
use expect_test::expect;
|
||||
|
||||
use crate::{
|
||||
ast::{self, make, syntax_factory::SyntaxFactory},
|
||||
AstNode, SyntaxKind,
|
||||
ast::{self, make, syntax_factory::SyntaxFactory},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
|
@ -445,11 +445,12 @@ mod tests {
|
|||
expect.assert_eq(&edit.new_root.to_string());
|
||||
|
||||
assert_eq!(edit.find_annotation(placeholder_snippet).len(), 2);
|
||||
assert!(edit
|
||||
.annotations
|
||||
.iter()
|
||||
.flat_map(|(_, elements)| elements)
|
||||
.all(|element| element.ancestors().any(|it| &it == edit.new_root())))
|
||||
assert!(
|
||||
edit.annotations
|
||||
.iter()
|
||||
.flat_map(|(_, elements)| elements)
|
||||
.all(|element| element.ancestors().any(|it| &it == edit.new_root()))
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -11,8 +11,8 @@ use rustc_hash::FxHashMap;
|
|||
use stdx::format_to;
|
||||
|
||||
use crate::{
|
||||
syntax_editor::{mapping::MissingMapping, Change, ChangeKind, PositionRepr},
|
||||
SyntaxElement, SyntaxNode, SyntaxNodePtr,
|
||||
syntax_editor::{Change, ChangeKind, PositionRepr, mapping::MissingMapping},
|
||||
};
|
||||
|
||||
use super::{SyntaxEdit, SyntaxEditor};
|
||||
|
@ -208,18 +208,26 @@ pub(super) fn apply_edits(editor: SyntaxEditor) -> SyntaxEdit {
|
|||
}
|
||||
};
|
||||
|
||||
let upmap_target_node = |target: &SyntaxNode| {
|
||||
match mappings.upmap_child(target, &input_ancestor, &output_ancestor) {
|
||||
Ok(it) => it,
|
||||
Err(MissingMapping(current)) => unreachable!("no mappings exist between {current:?} (ancestor of {input_ancestor:?}) and {output_ancestor:?}"),
|
||||
}
|
||||
let upmap_target_node = |target: &SyntaxNode| match mappings.upmap_child(
|
||||
target,
|
||||
&input_ancestor,
|
||||
&output_ancestor,
|
||||
) {
|
||||
Ok(it) => it,
|
||||
Err(MissingMapping(current)) => unreachable!(
|
||||
"no mappings exist between {current:?} (ancestor of {input_ancestor:?}) and {output_ancestor:?}"
|
||||
),
|
||||
};
|
||||
|
||||
let upmap_target = |target: &SyntaxElement| {
|
||||
match mappings.upmap_child_element(target, &input_ancestor, &output_ancestor) {
|
||||
Ok(it) => it,
|
||||
Err(MissingMapping(current)) => unreachable!("no mappings exist between {current:?} (ancestor of {input_ancestor:?}) and {output_ancestor:?}"),
|
||||
}
|
||||
let upmap_target = |target: &SyntaxElement| match mappings.upmap_child_element(
|
||||
target,
|
||||
&input_ancestor,
|
||||
&output_ancestor,
|
||||
) {
|
||||
Ok(it) => it,
|
||||
Err(MissingMapping(current)) => unreachable!(
|
||||
"no mappings exist between {current:?} (ancestor of {input_ancestor:?}) and {output_ancestor:?}"
|
||||
),
|
||||
};
|
||||
|
||||
match &mut changes[child as usize] {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
//! Structural editing for ast using `SyntaxEditor`
|
||||
|
||||
use crate::{
|
||||
Direction, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, T,
|
||||
ast::{
|
||||
self, edit::IndentLevel, make, syntax_factory::SyntaxFactory, AstNode, Fn, GenericParam,
|
||||
HasGenericParams, HasName,
|
||||
self, AstNode, Fn, GenericParam, HasGenericParams, HasName, edit::IndentLevel, make,
|
||||
syntax_factory::SyntaxFactory,
|
||||
},
|
||||
syntax_editor::{Position, SyntaxEditor},
|
||||
Direction, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, T,
|
||||
};
|
||||
|
||||
impl SyntaxEditor {
|
||||
|
|
|
@ -7,8 +7,8 @@ use std::{mem, ops::RangeInclusive};
|
|||
use parser::T;
|
||||
|
||||
use crate::{
|
||||
ast::{self, edit::IndentLevel, make, AstNode},
|
||||
SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken,
|
||||
ast::{self, AstNode, edit::IndentLevel, make},
|
||||
};
|
||||
|
||||
/// Utility trait to allow calling `ted` functions with references or owned
|
||||
|
|
|
@ -10,7 +10,7 @@ use rayon::prelude::*;
|
|||
use stdx::format_to_acc;
|
||||
use test_utils::{bench, bench_fixture, project_root};
|
||||
|
||||
use crate::{ast, fuzz, AstNode, SourceFile, SyntaxError};
|
||||
use crate::{AstNode, SourceFile, SyntaxError, ast, fuzz};
|
||||
|
||||
#[test]
|
||||
fn parse_smoke_test() {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
mod block;
|
||||
|
||||
use rowan::Direction;
|
||||
use rustc_lexer::unescape::{self, unescape_mixed, unescape_unicode, Mode};
|
||||
use rustc_lexer::unescape::{self, Mode, unescape_mixed, unescape_unicode};
|
||||
|
||||
use crate::{
|
||||
algo,
|
||||
ast::{self, HasAttrs, HasVisibility, IsString, RangeItem},
|
||||
match_ast, AstNode, SyntaxError,
|
||||
AstNode, SyntaxError,
|
||||
SyntaxKind::{CONST, FN, INT_NUMBER, TYPE_ALIAS},
|
||||
SyntaxNode, SyntaxToken, TextSize, T,
|
||||
SyntaxNode, SyntaxToken, T, TextSize, algo,
|
||||
ast::{self, HasAttrs, HasVisibility, IsString, RangeItem},
|
||||
match_ast,
|
||||
};
|
||||
|
||||
pub(crate) fn validate(root: &SyntaxNode, errors: &mut Vec<SyntaxError>) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//! Logic for validating block expressions i.e. `ast::BlockExpr`.
|
||||
|
||||
use crate::{
|
||||
ast::{self, AstNode, HasAttrs},
|
||||
SyntaxError,
|
||||
SyntaxKind::*,
|
||||
ast::{self, AstNode, HasAttrs},
|
||||
};
|
||||
|
||||
pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue