Skip to content

Commit 77f2c57

Browse files
authoredOct 24, 2024
Rollup merge of #131623 - matthiaskrgr:clippy_sat, r=Nadrieril
misc cleanups
2 parents 40d7872 + d84d659 commit 77f2c57

File tree

7 files changed

+11
-18
lines changed

7 files changed

+11
-18
lines changed
 

‎compiler/rustc_attr/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -619,11 +619,11 @@ pub fn eval_condition(
619619
// we can't use `try_gate_cfg` as symbols don't differentiate between `r#true`
620620
// and `true`, and we want to keep the former working without feature gate
621621
gate_cfg(
622-
&((
622+
&(
623623
if *b { kw::True } else { kw::False },
624624
sym::cfg_boolean_literals,
625625
|features: &Features| features.cfg_boolean_literals(),
626-
)),
626+
),
627627
cfg.span(),
628628
sess,
629629
features,

‎compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -959,13 +959,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
959959
None
960960
}
961961
}
962-
hir::ExprKind::MethodCall(_, _, args, span) => {
963-
if let Some(def_id) = typeck_results.type_dependent_def_id(*hir_id) {
964-
Some((def_id, *span, *args))
965-
} else {
966-
None
967-
}
968-
}
962+
hir::ExprKind::MethodCall(_, _, args, span) => typeck_results
963+
.type_dependent_def_id(*hir_id)
964+
.map(|def_id| (def_id, *span, *args)),
969965
_ => None,
970966
}
971967
};

‎compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
537537
&& binding_id != self.binding_id
538538
{
539539
if self.check_and_add_sugg_binding(LetStmt {
540-
ty_hir_id_opt: if let Some(ty) = ty { Some(ty.hir_id) } else { None },
540+
ty_hir_id_opt: ty.map(|ty| ty.hir_id),
541541
binding_id,
542542
span: pat.span,
543543
init_hir_id: init.hir_id,

‎compiler/rustc_infer/src/infer/type_variable.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
187187
value_count: usize,
188188
) -> (Range<TyVid>, Vec<TypeVariableOrigin>) {
189189
let range = TyVid::from_usize(value_count)..TyVid::from_usize(self.num_vars());
190-
(
191-
range.start..range.end,
192-
(range.start..range.end).map(|index| self.var_origin(index)).collect(),
193-
)
190+
(range.clone(), range.map(|index| self.var_origin(index)).collect())
194191
}
195192

196193
/// Returns indices of all variables that are not yet

‎compiler/rustc_middle/src/mir/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ pub fn create_dump_file<'tcx>(
277277
)
278278
})?;
279279
}
280-
Ok(fs::File::create_buffered(&file_path).map_err(|e| {
280+
fs::File::create_buffered(&file_path).map_err(|e| {
281281
io::Error::new(e.kind(), format!("IO error creating MIR dump file: {file_path:?}; {e}"))
282-
})?)
282+
})
283283
}
284284

285285
///////////////////////////////////////////////////////////////////////////

‎compiler/rustc_mir_transform/src/coverage/mappings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ fn calc_test_vectors_index(conditions: &mut Vec<MCDCBranch>) -> usize {
363363
let ConditionInfo { condition_id, true_next_id, false_next_id } = branch.condition_info;
364364
[true_next_id, false_next_id]
365365
.into_iter()
366-
.filter_map(std::convert::identity)
366+
.flatten()
367367
.for_each(|next_id| indegree_stats[next_id] += 1);
368368
(condition_id, branch)
369369
})

‎compiler/rustc_mir_transform/src/coverage/spans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn remove_unwanted_expansion_spans(covspans: &mut Vec<SpanFromMir>) {
8787
covspans.retain(|covspan| {
8888
match covspan.expn_kind {
8989
// Retain only the first await-related or macro-expanded covspan with this span.
90-
Some(ExpnKind::Desugaring(kind)) if kind == DesugaringKind::Await => {
90+
Some(ExpnKind::Desugaring(DesugaringKind::Await)) => {
9191
deduplicated_spans.insert(covspan.span)
9292
}
9393
Some(ExpnKind::Macro(MacroKind::Bang, _)) => deduplicated_spans.insert(covspan.span),

0 commit comments

Comments
 (0)
Please sign in to comment.