Skip to content

Commit 5ac6804

Browse files
committed
cargo fmt
1 parent aabd41c commit 5ac6804

File tree

9 files changed

+38
-61
lines changed

9 files changed

+38
-61
lines changed

crates/hir_def/src/lib.rs

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,11 @@ fn macro_call_as_call_id(
731731
)
732732
.map(MacroCallId::from)
733733
} else {
734-
Ok(def
735-
.as_lazy_macro(
736-
db.upcast(),
737-
krate,
738-
MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
739-
))
734+
Ok(def.as_lazy_macro(
735+
db.upcast(),
736+
krate,
737+
MacroCallKind::FnLike { ast_id: call.ast_id, fragment },
738+
))
740739
};
741740
Ok(res)
742741
}
@@ -755,16 +754,15 @@ fn derive_macro_as_call_id(
755754
.segments()
756755
.last()
757756
.ok_or_else(|| UnresolvedMacro { path: item_attr.path.clone() })?;
758-
let res = def
759-
.as_lazy_macro(
760-
db.upcast(),
761-
krate,
762-
MacroCallKind::Derive {
763-
ast_id: item_attr.ast_id,
764-
derive_name: last_segment.to_string(),
765-
derive_attr_index: derive_attr.ast_index,
766-
},
767-
);
757+
let res = def.as_lazy_macro(
758+
db.upcast(),
759+
krate,
760+
MacroCallKind::Derive {
761+
ast_id: item_attr.ast_id,
762+
derive_name: last_segment.to_string(),
763+
derive_attr_index: derive_attr.ast_index,
764+
},
765+
);
768766
Ok(res)
769767
}
770768

@@ -792,16 +790,15 @@ fn attr_macro_as_call_id(
792790
// The parentheses are always disposed here.
793791
arg.delimiter = None;
794792

795-
let res = def
796-
.as_lazy_macro(
797-
db.upcast(),
798-
krate,
799-
MacroCallKind::Attr {
800-
ast_id: item_attr.ast_id,
801-
attr_name: last_segment.to_string(),
802-
attr_args: arg,
803-
invoc_attr_index: macro_attr.id.ast_index,
804-
},
805-
);
793+
let res = def.as_lazy_macro(
794+
db.upcast(),
795+
krate,
796+
MacroCallKind::Attr {
797+
ast_id: item_attr.ast_id,
798+
attr_name: last_segment.to_string(),
799+
attr_args: arg,
800+
invoc_attr_index: macro_attr.id.ast_index,
801+
},
802+
);
806803
Ok(res)
807804
}

crates/hir_expand/src/eager.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,11 @@ fn lazy_expand(
177177
let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value);
178178

179179
let fragment = crate::to_fragment_kind(&macro_call.value);
180-
let id: MacroCallId = def
181-
.as_lazy_macro(
182-
db,
183-
krate,
184-
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
185-
);
180+
let id: MacroCallId = def.as_lazy_macro(
181+
db,
182+
krate,
183+
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
184+
);
186185

187186
let err = db.macro_expand_error(id);
188187
let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node));

crates/hir_ty/src/chalk_db.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,7 @@ pub(crate) fn trait_datum_query(
430430
fundamental: false,
431431
};
432432
let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars);
433-
let associated_ty_ids =
434-
trait_data.associated_types().map(to_assoc_type_id).collect();
433+
let associated_ty_ids = trait_data.associated_types().map(to_assoc_type_id).collect();
435434
let trait_datum_bound = rust_ir::TraitDatumBound { where_clauses };
436435
let well_known =
437436
lang_attr(db.upcast(), trait_).and_then(|name| well_known_trait_from_lang_attr(&name));

crates/hir_ty/src/infer/expr.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,7 @@ impl<'a> InferenceContext<'a> {
327327
self.normalize_associated_types_in(ret_ty)
328328
}
329329
Expr::MethodCall { receiver, args, method_name, generic_args } => self
330-
.infer_method_call(
331-
tgt_expr,
332-
*receiver,
333-
args,
334-
method_name,
335-
generic_args.as_deref(),
336-
),
330+
.infer_method_call(tgt_expr, *receiver, args, method_name, generic_args.as_deref()),
337331
Expr::Match { expr, arms } => {
338332
let input_ty = self.infer_expr(*expr, &Expectation::none());
339333

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -526,11 +526,9 @@ fn highlight_name_ref_by_syntax(
526526
};
527527

528528
match parent.kind() {
529-
METHOD_CALL_EXPR => {
530-
ast::MethodCallExpr::cast(parent)
531-
.and_then(|it| highlight_method_call(sema, krate, &it))
532-
.unwrap_or_else(|| SymbolKind::Function.into())
533-
}
529+
METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent)
530+
.and_then(|it| highlight_method_call(sema, krate, &it))
531+
.unwrap_or_else(|| SymbolKind::Function.into()),
534532
FIELD_EXPR => {
535533
let h = HlTag::Symbol(SymbolKind::Field);
536534
let is_union = ast::FieldExpr::cast(parent)

crates/ide_assists/src/assist_context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ impl AssistBuilder {
291291
algo::diff(old.syntax(), new.syntax()).into_text_edit(&mut self.edit)
292292
}
293293
pub(crate) fn create_file(&mut self, dst: AnchoredPathBuf, content: impl Into<String>) {
294-
let file_system_edit =
295-
FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
294+
let file_system_edit = FileSystemEdit::CreateFile { dst, initial_contents: content.into() };
296295
self.source_change.push_file_system_edit(file_system_edit);
297296
}
298297

crates/ide_db/src/search.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,7 @@ impl<'a> FindUsages<'a> {
490490
Some(NameRefClass::FieldShorthand { local_ref: local, field_ref: field }) => {
491491
let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax());
492492
let access = match self.def {
493-
Definition::Field(_) if field == self.def => {
494-
reference_access(&field, name_ref)
495-
}
493+
Definition::Field(_) if field == self.def => reference_access(&field, name_ref),
496494
Definition::Local(l) if local == l => {
497495
reference_access(&Definition::Local(local), name_ref)
498496
}

crates/proc_macro_api/src/process.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ impl ProcMacroProcessSrv {
7676
.map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?;
7777

7878
match res {
79-
Some(Response::Error(err)) => {
80-
Err(tt::ExpansionError::ExpansionError(err.message))
81-
}
79+
Some(Response::Error(err)) => Err(tt::ExpansionError::ExpansionError(err.message)),
8280
Some(res) => Ok(res.try_into().map_err(|err| {
8381
tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err))
8482
})?),

crates/proc_macro_srv/src/proc_macro/diagnostic.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ impl Diagnostic {
101101
S: MultiSpan,
102102
T: Into<String>,
103103
{
104-
Diagnostic {
105-
level,
106-
message: message.into(),
107-
spans: spans.into_spans(),
108-
children: vec![],
109-
}
104+
Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] }
110105
}
111106

112107
diagnostic_child_methods!(span_error, error, Level::Error);

0 commit comments

Comments
 (0)