Skip to content

Commit dab76ec

Browse files
committed
fix a couple clippy:complexitys
double_parens filter_map_identity needless_question_mark redundant_guards
1 parent be01dab commit dab76ec

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
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_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)