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