Skip to content

Commit 7e285e1

Browse files
Run cargo fmt
1 parent 8318035 commit 7e285e1

35 files changed

+190
-45
lines changed

crates/hir-def/src/path.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ impl<'a> PathSegments<'a> {
188188
}
189189

190190
impl GenericArgs {
191-
pub(crate) fn from_ast(lower_ctx: &LowerCtx<'_>, node: ast::GenericArgList) -> Option<GenericArgs> {
191+
pub(crate) fn from_ast(
192+
lower_ctx: &LowerCtx<'_>,
193+
node: ast::GenericArgList,
194+
) -> Option<GenericArgs> {
192195
lower::lower_generic_args(lower_ctx, node)
193196
}
194197

crates/hir-ty/src/autoderef.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ impl Iterator for Autoderef<'_, '_> {
7070
}
7171
}
7272

73-
pub(crate) fn autoderef_step(table: &mut InferenceTable<'_>, ty: Ty) -> Option<(AutoderefKind, Ty)> {
73+
pub(crate) fn autoderef_step(
74+
table: &mut InferenceTable<'_>,
75+
ty: Ty,
76+
) -> Option<(AutoderefKind, Ty)> {
7477
if let Some(derefed) = builtin_deref(&ty) {
7578
Some((AutoderefKind::Builtin, table.resolve_ty_shallow(derefed)))
7679
} else {

crates/hir-ty/src/display.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,11 @@ fn write_bounds_like_dyn_trait(
952952
Ok(())
953953
}
954954

955-
fn fmt_trait_ref(tr: &TraitRef, f: &mut HirFormatter<'_>, use_as: bool) -> Result<(), HirDisplayError> {
955+
fn fmt_trait_ref(
956+
tr: &TraitRef,
957+
f: &mut HirFormatter<'_>,
958+
use_as: bool,
959+
) -> Result<(), HirDisplayError> {
956960
if f.should_truncate() {
957961
return write!(f, "{}", TYPE_HINT_TRUNCATION);
958962
}

crates/hir-ty/src/infer.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ trait PatLike: Into<ExprOrPatId> + Copy {
140140
impl PatLike for ExprId {
141141
type BindingMode = ();
142142

143-
fn infer(this: &mut InferenceContext<'_>, id: Self, expected_ty: &Ty, _: Self::BindingMode) -> Ty {
143+
fn infer(
144+
this: &mut InferenceContext<'_>,
145+
id: Self,
146+
expected_ty: &Ty,
147+
_: Self::BindingMode,
148+
) -> Ty {
144149
this.infer_assignee_expr(id, expected_ty)
145150
}
146151
}

crates/hir/src/display.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,10 @@ impl HirDisplay for ConstParam {
289289
}
290290
}
291291

292-
fn write_generic_params(def: GenericDefId, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
292+
fn write_generic_params(
293+
def: GenericDefId,
294+
f: &mut HirFormatter<'_>,
295+
) -> Result<(), HirDisplayError> {
293296
let params = f.db.generic_params(def);
294297
if params.lifetimes.is_empty()
295298
&& params.type_or_consts.iter().all(|x| x.1.const_param().is_none())
@@ -381,8 +384,9 @@ fn write_where_clause(def: GenericDefId, f: &mut HirFormatter<'_>) -> Result<(),
381384
let prev_pred =
382385
if pred_idx == 0 { None } else { Some(&params.where_predicates[pred_idx - 1]) };
383386

384-
let new_predicate =
385-
|f: &mut HirFormatter<'_>| f.write_str(if pred_idx == 0 { "\n " } else { ",\n " });
387+
let new_predicate = |f: &mut HirFormatter<'_>| {
388+
f.write_str(if pred_idx == 0 { "\n " } else { ",\n " })
389+
};
386390

387391
match pred {
388392
WherePredicate::TypeBound { target, .. } if is_unnamed_type_target(target) => {}

crates/ide-assists/src/handlers/add_missing_impl_members.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ pub(crate) fn add_missing_impl_members(acc: &mut Assists, ctx: &AssistContext<'_
8585
// $0fn bar(&self) {}
8686
// }
8787
// ```
88-
pub(crate) fn add_missing_default_members(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
88+
pub(crate) fn add_missing_default_members(
89+
acc: &mut Assists,
90+
ctx: &AssistContext<'_>,
91+
) -> Option<()> {
8992
add_missing_impl_members_inner(
9093
acc,
9194
ctx,

crates/ide-assists/src/handlers/auto_import.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<
142142
Some(())
143143
}
144144

145-
pub(super) fn find_importable_node(ctx: &AssistContext<'_>) -> Option<(ImportAssets, SyntaxElement)> {
145+
pub(super) fn find_importable_node(
146+
ctx: &AssistContext<'_>,
147+
) -> Option<(ImportAssets, SyntaxElement)> {
146148
if let Some(path_under_caret) = ctx.find_node_at_offset_with_descend::<ast::Path>() {
147149
ImportAssets::for_exact_path(&path_under_caret, &ctx.sema)
148150
.zip(Some(path_under_caret.syntax().clone().into()))

crates/ide-assists/src/handlers/convert_iter_for_each_to_for.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
3232
// }
3333
// }
3434
// ```
35-
pub(crate) fn convert_iter_for_each_to_for(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
35+
pub(crate) fn convert_iter_for_each_to_for(
36+
acc: &mut Assists,
37+
ctx: &AssistContext<'_>,
38+
) -> Option<()> {
3639
let method = ctx.find_node_at_offset::<ast::MethodCallExpr>()?;
3740

3841
let closure = match method.arg_list()?.args().next()? {
@@ -91,7 +94,10 @@ pub(crate) fn convert_iter_for_each_to_for(acc: &mut Assists, ctx: &AssistContex
9194
// });
9295
// }
9396
// ```
94-
pub(crate) fn convert_for_loop_with_for_each(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
97+
pub(crate) fn convert_for_loop_with_for_each(
98+
acc: &mut Assists,
99+
ctx: &AssistContext<'_>,
100+
) -> Option<()> {
95101
let for_loop = ctx.find_node_at_offset::<ast::ForExpr>()?;
96102
let iterable = for_loop.iterable()?;
97103
let pat = for_loop.pat()?;

crates/ide-assists/src/handlers/extract_function.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,11 @@ fn generic_parents(parent: &SyntaxNode) -> Vec<GenericParent> {
10421042
}
10431043

10441044
/// checks if relevant var is used with `&mut` access inside body
1045-
fn has_exclusive_usages(ctx: &AssistContext<'_>, usages: &LocalUsages, body: &FunctionBody) -> bool {
1045+
fn has_exclusive_usages(
1046+
ctx: &AssistContext<'_>,
1047+
usages: &LocalUsages,
1048+
body: &FunctionBody,
1049+
) -> bool {
10461050
usages
10471051
.iter()
10481052
.filter(|reference| body.contains_range(reference.range))

crates/ide-assists/src/handlers/generate_enum_projection_method.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ use crate::{
3636
// }
3737
// }
3838
// ```
39-
pub(crate) fn generate_enum_try_into_method(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
39+
pub(crate) fn generate_enum_try_into_method(
40+
acc: &mut Assists,
41+
ctx: &AssistContext<'_>,
42+
) -> Option<()> {
4043
generate_enum_projection_method(
4144
acc,
4245
ctx,

0 commit comments

Comments
 (0)