Skip to content

Commit 71d4dba

Browse files
committed
redundant_pattern_matching
1 parent 5a62a0d commit 71d4dba

File tree

17 files changed

+39
-46
lines changed

17 files changed

+39
-46
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ needless_doctest_main = "allow"
177177
new_without_default = "allow"
178178
non_canonical_clone_impl = "allow"
179179
non_canonical_partial_ord_impl = "allow"
180-
redundant_pattern_matching = "allow"
181180
search_is_some = "allow"
182181
self_named_constructors = "allow"
183182
single_match = "allow"

crates/base-db/src/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ impl CrateData {
331331
return false;
332332
}
333333

334-
if let Some(_) = opts.next() {
334+
if opts.next().is_some() {
335335
return false;
336336
}
337337
}

crates/hir-def/src/path/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub(super) fn lower_path(ctx: &LowerCtx<'_>, mut path: ast::Path) -> Option<Path
5353
)
5454
})
5555
.map(Interned::new);
56-
if let Some(_) = args {
56+
if args.is_some() {
5757
generic_args.resize(segments.len(), None);
5858
generic_args.push(args);
5959
}

crates/hir-ty/src/display.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,15 +1043,15 @@ impl HirDisplay for Ty {
10431043
f.start_location_link(t.into());
10441044
}
10451045
write!(f, "Future")?;
1046-
if let Some(_) = future_trait {
1046+
if future_trait.is_some() {
10471047
f.end_location_link();
10481048
}
10491049
write!(f, "<")?;
10501050
if let Some(t) = output {
10511051
f.start_location_link(t.into());
10521052
}
10531053
write!(f, "Output")?;
1054-
if let Some(_) = output {
1054+
if output.is_some() {
10551055
f.end_location_link();
10561056
}
10571057
write!(f, " = ")?;
@@ -1520,7 +1520,7 @@ fn write_bounds_like_dyn_trait(
15201520
}
15211521
write!(f, "Sized")?;
15221522
}
1523-
if let Some(_) = sized_trait {
1523+
if sized_trait.is_some() {
15241524
f.end_location_link();
15251525
}
15261526
}

crates/hir-ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl InferenceContext<'_> {
439439
ty
440440
}
441441
&Expr::Continue { label } => {
442-
if let None = find_continuable(&mut self.breakables, label) {
442+
if find_continuable(&mut self.breakables, label).is_none() {
443443
self.push_diagnostic(InferenceDiagnostic::BreakOutsideOfLoop {
444444
expr: tgt_expr,
445445
is_break: false,

crates/hir-ty/src/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ fn named_associated_type_shorthand_candidates<R>(
13351335
),
13361336
_ => None,
13371337
});
1338-
if let Some(_) = res {
1338+
if res.is_some() {
13391339
return res;
13401340
}
13411341
// Handle `Self::Type` referring to own associated type in trait definitions

crates/hir-ty/src/mir/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ impl Evaluator<'_> {
22172217
let generic_args = generic_args.clone();
22182218
match def {
22192219
CallableDefId::FunctionId(def) => {
2220-
if let Some(_) = self.detect_fn_trait(def) {
2220+
if self.detect_fn_trait(def).is_some() {
22212221
return self.exec_fn_trait(
22222222
def,
22232223
args,

crates/hir/src/source_analyzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl SourceAnalyzer {
614614
}
615615
None
616616
})();
617-
if let Some(_) = resolved {
617+
if resolved.is_some() {
618618
return resolved;
619619
}
620620

@@ -659,7 +659,7 @@ impl SourceAnalyzer {
659659
if let Some(name_ref) = path.as_single_name_ref() {
660660
let builtin =
661661
BuiltinAttr::by_name(db, self.resolver.krate().into(), &name_ref.text());
662-
if let Some(_) = builtin {
662+
if builtin.is_some() {
663663
return builtin.map(PathResolution::BuiltinAttr);
664664
}
665665

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub(super) fn find_importable_node(
198198
{
199199
ImportAssets::for_method_call(&method_under_caret, &ctx.sema)
200200
.zip(Some(method_under_caret.syntax().clone().into()))
201-
} else if let Some(_) = ctx.find_node_at_offset_with_descend::<ast::Param>() {
201+
} else if ctx.find_node_at_offset_with_descend::<ast::Param>().is_some() {
202202
None
203203
} else if let Some(pat) = ctx
204204
.find_node_at_offset_with_descend::<ast::IdentPat>()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
2929
let name = nominal.name()?;
3030
let target = nominal.syntax().text_range();
3131

32-
if let Some(_) = ctx.find_node_at_offset::<ast::RecordFieldList>() {
32+
if ctx.find_node_at_offset::<ast::RecordFieldList>().is_some() {
3333
return None;
3434
}
3535

@@ -77,7 +77,7 @@ pub(crate) fn generate_trait_impl(acc: &mut Assists, ctx: &AssistContext<'_>) ->
7777
let name = nominal.name()?;
7878
let target = nominal.syntax().text_range();
7979

80-
if let Some(_) = ctx.find_node_at_offset::<ast::RecordFieldList>() {
80+
if ctx.find_node_at_offset::<ast::RecordFieldList>().is_some() {
8181
return None;
8282
}
8383

0 commit comments

Comments
 (0)