Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r--crates/hir/src/semantics.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index a1c0521a5e..604099aaa5 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -12,6 +12,7 @@ use std::{
use either::Either;
use hir_def::{
+ AsMacroCall, DefWithBodyId, FunctionId, MacroId, StructId, TraitId, VariantId,
expr_store::{Body, ExprOrPatSource},
hir::{BindingId, Expr, ExprId, ExprOrPatId, Pat},
lower::LowerCtx,
@@ -19,9 +20,9 @@ use hir_def::{
path::ModPath,
resolver::{self, HasResolver, Resolver, TypeNs},
type_ref::{Mutability, TypesMap, TypesSourceMap},
- AsMacroCall, DefWithBodyId, FunctionId, MacroId, StructId, TraitId, VariantId,
};
use hir_expand::{
+ ExpandResult, FileRange, InMacroFile, MacroCallId, MacroFileId, MacroFileIdExt,
attrs::collect_attrs,
builtin::{BuiltinFnLikeExpander, EagerExpander},
db::ExpandDatabase,
@@ -29,32 +30,31 @@ use hir_expand::{
hygiene::SyntaxContextExt as _,
inert_attr_macro::find_builtin_attr_idx,
name::AsName,
- ExpandResult, FileRange, InMacroFile, MacroCallId, MacroFileId, MacroFileIdExt,
};
use hir_ty::diagnostics::unsafe_operations_for_body;
-use intern::{sym, Symbol};
+use intern::{Symbol, sym};
use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};
-use smallvec::{smallvec, SmallVec};
+use smallvec::{SmallVec, smallvec};
use span::{AstIdMap, EditionedFileId, FileId, HirFileIdRepr, SyntaxContext};
use stdx::TupleExt;
use syntax::{
- algo::skip_trivia_token,
- ast::{self, HasAttrs as _, HasGenericParams},
AstNode, AstToken, Direction, SyntaxKind, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange,
TextSize,
+ algo::skip_trivia_token,
+ ast::{self, HasAttrs as _, HasGenericParams},
};
use triomphe::Arc;
use crate::{
- db::HirDatabase,
- semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
- source_analyzer::{name_hygiene, resolve_hir_path, SourceAnalyzer},
Adjust, Adjustment, Adt, AutoBorrow, BindingMode, BuiltinAttr, Callable, Const, ConstParam,
Crate, DefWithBody, DeriveHelper, Enum, Field, Function, GenericSubstitution, HasSource,
HirFileId, Impl, InFile, InlineAsmOperand, ItemInNs, Label, LifetimeParam, Local, Macro,
Module, ModuleDef, Name, OverloadedDeref, Path, ScopeDef, Static, Struct, ToolModule, Trait,
TraitAlias, TupleField, Type, TypeAlias, TypeParam, Union, Variant, VariantDef,
+ db::HirDatabase,
+ semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
+ source_analyzer::{SourceAnalyzer, name_hygiene, resolve_hir_path},
};
const CONTINUE_NO_BREAKS: ControlFlow<Infallible, ()> = ControlFlow::Continue(());
@@ -963,11 +963,7 @@ impl<'db> SemanticsImpl<'db> {
|| kind.is_any_identifier() && value.kind().is_any_identifier();
let matches =
(kind == mapped_kind || any_ident_match()) && text == value.text();
- if matches {
- ControlFlow::Break(value)
- } else {
- ControlFlow::Continue(())
- }
+ if matches { ControlFlow::Break(value) } else { ControlFlow::Continue(()) }
},
)
} else {
@@ -1780,7 +1776,7 @@ impl<'db> SemanticsImpl<'db> {
SourceAnalyzer::new_for_body(self.db, def, node, offset)
} else {
SourceAnalyzer::new_for_body_no_infer(self.db, def, node, offset)
- })
+ });
}
ChildContainer::TraitId(it) => it.resolver(self.db.upcast()),
ChildContainer::TraitAliasId(it) => it.resolver(self.db.upcast()),