mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
cargo fmt
This commit is contained in:
parent
aabd41cafc
commit
5ac6804bb3
@ -731,8 +731,7 @@ fn macro_call_as_call_id(
|
|||||||
)
|
)
|
||||||
.map(MacroCallId::from)
|
.map(MacroCallId::from)
|
||||||
} else {
|
} else {
|
||||||
Ok(def
|
Ok(def.as_lazy_macro(
|
||||||
.as_lazy_macro(
|
|
||||||
db.upcast(),
|
db.upcast(),
|
||||||
krate,
|
krate,
|
||||||
MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
|
MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
|
||||||
@ -755,8 +754,7 @@ fn derive_macro_as_call_id(
|
|||||||
.segments()
|
.segments()
|
||||||
.last()
|
.last()
|
||||||
.ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
|
.ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
|
||||||
let res = def
|
let res = def.as_lazy_macro(
|
||||||
.as_lazy_macro(
|
|
||||||
db.upcast(),
|
db.upcast(),
|
||||||
krate,
|
krate,
|
||||||
MacroCallKind::Derive {
|
MacroCallKind::Derive {
|
||||||
@ -792,8 +790,7 @@ fn attr_macro_as_call_id(
|
|||||||
// The parentheses are always disposed here.
|
// The parentheses are always disposed here.
|
||||||
arg.delimiter = None;
|
arg.delimiter = None;
|
||||||
|
|
||||||
let res = def
|
let res = def.as_lazy_macro(
|
||||||
.as_lazy_macro(
|
|
||||||
db.upcast(),
|
db.upcast(),
|
||||||
krate,
|
krate,
|
||||||
MacroCallKind::Attr {
|
MacroCallKind::Attr {
|
||||||
|
@ -177,8 +177,7 @@ fn lazy_expand(
|
|||||||
let ast_id = db.ast_id_map(macro_call.file_id).ast_id(¯o_call.value);
|
let ast_id = db.ast_id_map(macro_call.file_id).ast_id(¯o_call.value);
|
||||||
|
|
||||||
let fragment = crate::to_fragment_kind(¯o_call.value);
|
let fragment = crate::to_fragment_kind(¯o_call.value);
|
||||||
let id: MacroCallId = def
|
let id: MacroCallId = def.as_lazy_macro(
|
||||||
.as_lazy_macro(
|
|
||||||
db,
|
db,
|
||||||
krate,
|
krate,
|
||||||
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
|
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
|
||||||
|
@ -430,8 +430,7 @@ pub(crate) fn trait_datum_query(
|
|||||||
fundamental: false,
|
fundamental: false,
|
||||||
};
|
};
|
||||||
let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
|
let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
|
||||||
let associated_ty_ids =
|
let associated_ty_ids = trait_data.associated_types().map(to_assoc_type_id).collect();
|
||||||
trait_data.associated_types().map(to_assoc_type_id).collect();
|
|
||||||
let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
|
let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
|
||||||
let well_known =
|
let well_known =
|
||||||
lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));
|
lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));
|
||||||
|
@ -327,13 +327,7 @@ impl<'a> InferenceContext<'a> {
|
|||||||
self.normalize_associated_types_in(ret_ty)
|
self.normalize_associated_types_in(ret_ty)
|
||||||
}
|
}
|
||||||
Expr::MethodCall { receiver, args, method_name, generic_args } => self
|
Expr::MethodCall { receiver, args, method_name, generic_args } => self
|
||||||
.infer_method_call(
|
.infer_method_call(tgt_expr, *receiver, args, method_name, generic_args.as_deref()),
|
||||||
tgt_expr,
|
|
||||||
*receiver,
|
|
||||||
args,
|
|
||||||
method_name,
|
|
||||||
generic_args.as_deref(),
|
|
||||||
),
|
|
||||||
Expr::Match { expr, arms } => {
|
Expr::Match { expr, arms } => {
|
||||||
let input_ty = self.infer_expr(*expr, &Expectation::none());
|
let input_ty = self.infer_expr(*expr, &Expectation::none());
|
||||||
|
|
||||||
|
@ -526,11 +526,9 @@ fn highlight_name_ref_by_syntax(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match parent.kind() {
|
match parent.kind() {
|
||||||
METHOD_CALL_EXPR => {
|
METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent)
|
||||||
ast::MethodCallExpr::cast(parent)
|
|
||||||
.and_then(|it| highlight_method_call(sema, krate, &it))
|
.and_then(|it| highlight_method_call(sema, krate, &it))
|
||||||
.unwrap_or_else(|| SymbolKind::Function.into())
|
.unwrap_or_else(|| SymbolKind::Function.into()),
|
||||||
}
|
|
||||||
FIELD_EXPR => {
|
FIELD_EXPR => {
|
||||||
let h = HlTag::Symbol(SymbolKind::Field);
|
let h = HlTag::Symbol(SymbolKind::Field);
|
||||||
let is_union = ast::FieldExpr::cast(parent)
|
let is_union = ast::FieldExpr::cast(parent)
|
||||||
|
@ -291,8 +291,7 @@ impl AssistBuilder {
|
|||||||
algo::diff(old.syntax(), new.syntax()).into_text_edit(&mut self.edit)
|
algo::diff(old.syntax(), new.syntax()).into_text_edit(&mut self.edit)
|
||||||
}
|
}
|
||||||
pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
|
pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
|
||||||
let file_system_edit =
|
let file_system_edit = FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
|
||||||
FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
|
|
||||||
self.source_change.push_file_system_edit(file_system_edit);
|
self.source_change.push_file_system_edit(file_system_edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,9 +490,7 @@ impl<'a> FindUsages<'a> {
|
|||||||
Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => {
|
Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => {
|
||||||
let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
|
let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
|
||||||
let access = match self.def {
|
let access = match self.def {
|
||||||
Definition::Field(_) if field == self.def => {
|
Definition::Field(_) if field == self.def => reference_access(&field, name_ref),
|
||||||
reference_access(&field, name_ref)
|
|
||||||
}
|
|
||||||
Definition::Local(l) if local == l => {
|
Definition::Local(l) if local == l => {
|
||||||
reference_access(&Definition::Local(local), name_ref)
|
reference_access(&Definition::Local(local), name_ref)
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,7 @@ impl ProcMacroProcessSrv {
|
|||||||
.map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?;
|
.map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?;
|
||||||
|
|
||||||
match res {
|
match res {
|
||||||
Some(Response::Error(err)) => {
|
Some(Response::Error(err)) => Err(tt::ExpansionError::ExpansionError(err.message)),
|
||||||
Err(tt::ExpansionError::ExpansionError(err.message))
|
|
||||||
}
|
|
||||||
Some(res) => Ok(res.try_into().map_err(|err| {
|
Some(res) => Ok(res.try_into().map_err(|err| {
|
||||||
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
|
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
|
||||||
})?),
|
})?),
|
||||||
|
@ -101,12 +101,7 @@ impl Diagnostic {
|
|||||||
S: MultiSpan,
|
S: MultiSpan,
|
||||||
T: Into<String>,
|
T: Into<String>,
|
||||||
{
|
{
|
||||||
Diagnostic {
|
Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] }
|
||||||
level,
|
|
||||||
message: message.into(),
|
|
||||||
spans: spans.into_spans(),
|
|
||||||
children: vec![],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostic_child_methods!(span_error, error, Level::Error);
|
diagnostic_child_methods!(span_error, error, Level::Error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user