@@ -114,7 +114,12 @@ fn check_addr_of_expr(
114
114
parent. span,
115
115
& format!( "unnecessary use of `{}`" , method_name) ,
116
116
"use" ,
117
- format!( "{:&>width$}{}" , "" , receiver_snippet, width = n_target_refs - n_receiver_refs) ,
117
+ format!(
118
+ "{:&>width$}{}" ,
119
+ "" ,
120
+ receiver_snippet,
121
+ width = n_target_refs - n_receiver_refs
122
+ ) ,
118
123
Applicability :: MachineApplicable ,
119
124
) ;
120
125
return true ;
@@ -182,20 +187,10 @@ fn check_into_iter_call_arg(cx: &LateContext<'_>, expr: &Expr<'_>, method_name:
182
187
if let Some ( item_ty) = get_iterator_item_ty( cx, parent_ty) ;
183
188
if let Some ( receiver_snippet) = snippet_opt( cx, receiver. span) ;
184
189
then {
185
- if unnecessary_iter_cloned:: check_for_loop_iter(
186
- cx,
187
- parent,
188
- method_name,
189
- receiver,
190
- true ,
191
- ) {
190
+ if unnecessary_iter_cloned:: check_for_loop_iter( cx, parent, method_name, receiver, true ) {
192
191
return true ;
193
192
}
194
- let cloned_or_copied = if is_copy( cx, item_ty) {
195
- "copied"
196
- } else {
197
- "cloned"
198
- } ;
193
+ let cloned_or_copied = if is_copy( cx, item_ty) { "copied" } else { "cloned" } ;
199
194
// The next suggestion may be incorrect because the removal of the `to_owned`-like
200
195
// function could cause the iterator to hold a reference to a resource that is used
201
196
// mutably. See https://github.com/rust-lang/rust-clippy/issues/8148.
@@ -243,18 +238,19 @@ fn check_other_call_arg<'tcx>(
243
238
if if trait_predicate. def_id( ) == deref_trait_id {
244
239
if let [ projection_predicate] = projection_predicates[ ..] {
245
240
let normalized_ty =
246
- cx. tcx. subst_and_normalize_erasing_regions( call_substs, cx. param_env, projection_predicate. term) ;
241
+ cx. tcx
242
+ . subst_and_normalize_erasing_regions( call_substs, cx. param_env, projection_predicate. term) ;
247
243
implements_trait( cx, receiver_ty, deref_trait_id, & [ ] )
248
- && get_associated_type( cx, receiver_ty, deref_trait_id,
249
- "Target" ) . map_or( false , |ty| ty:: Term :: Ty ( ty) == normalized_ty)
244
+ && get_associated_type( cx, receiver_ty, deref_trait_id, "Target" )
245
+ . map_or( false , |ty| ty:: Term :: Ty ( ty) == normalized_ty)
250
246
} else {
251
247
false
252
248
}
253
249
} else if trait_predicate. def_id( ) == as_ref_trait_id {
254
250
let composed_substs = compose_substs(
255
251
cx,
256
252
& trait_predicate. trait_ref. substs. iter( ) . skip( 1 ) . collect:: <Vec <_>>( ) [ ..] ,
257
- call_substs
253
+ call_substs,
258
254
) ;
259
255
implements_trait( cx, receiver_ty, as_ref_trait_id, & composed_substs)
260
256
} else {
@@ -339,11 +335,7 @@ fn get_input_traits_and_projections<'tcx>(
339
335
if let Some ( arg) = substs. iter( ) . next( ) ;
340
336
if let GenericArgKind :: Type ( arg_ty) = arg. unpack( ) ;
341
337
if arg_ty == input;
342
- then {
343
- true
344
- } else {
345
- false
346
- }
338
+ then { true } else { false }
347
339
}
348
340
} ;
349
341
match predicate. kind ( ) . skip_binder ( ) {
0 commit comments