Skip to content

Commit d666f6b

Browse files
committed
fix clippy::{filter_map_identiy, map_identity, manual_flatten}
1 parent 2816486 commit d666f6b

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

Diff for: compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
164164
{
165165
for param in
166166
[param_to_point_at, fallback_param_to_point_at, self_param_to_point_at]
167+
.into_iter()
168+
.flatten()
167169
{
168-
if let Some(param) = param {
169-
let refined_expr = self.point_at_field_if_possible(
170-
def_id,
171-
param,
172-
variant_def_id,
173-
fields,
174-
);
175-
176-
match refined_expr {
177-
None => {}
178-
Some((refined_expr, _)) => {
179-
error.obligation.cause.span = refined_expr
180-
.span
181-
.find_ancestor_in_same_ctxt(error.obligation.cause.span)
182-
.unwrap_or(refined_expr.span);
183-
return true;
184-
}
170+
let refined_expr =
171+
self.point_at_field_if_possible(def_id, param, variant_def_id, fields);
172+
173+
match refined_expr {
174+
None => {}
175+
Some((refined_expr, _)) => {
176+
error.obligation.cause.span = refined_expr
177+
.span
178+
.find_ancestor_in_same_ctxt(error.obligation.cause.span)
179+
.unwrap_or(refined_expr.span);
180+
return true;
185181
}
186182
}
187183
}

Diff for: compiler/rustc_monomorphize/src/partitioning/default.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'tcx> Partitioner<'tcx> for DefaultPartitioning {
8989
}
9090

9191
PreInliningPartitioning {
92-
codegen_units: codegen_units.into_values().map(|codegen_unit| codegen_unit).collect(),
92+
codegen_units: codegen_units.into_values().collect(),
9393
roots,
9494
internalization_candidates,
9595
}

Diff for: src/librustdoc/passes/collect_intra_doc_links.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ impl LinkCollector<'_, '_> {
13491349
if has_derive_trait_collision {
13501350
candidates.macro_ns = None;
13511351
}
1352-
candidates.into_iter().filter_map(|res| res).flatten().collect::<Vec<_>>()
1352+
candidates.into_iter().flatten().flatten().collect::<Vec<_>>()
13531353
}
13541354
}
13551355
}

0 commit comments

Comments
 (0)