Skip to content

Commit b44c218

Browse files
committed
Fix clippy errors
1 parent 06dd82d commit b44c218

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,10 +1734,10 @@ impl ExprCollector<'_> {
17341734
if ident.is_simple_ident() {
17351735
return ident
17361736
.name()
1737-
.and_then(|name| Some(name.as_name()))
1738-
.and_then(|hir_name| Some(Path::from(hir_name)))
1739-
.and_then(|path| {
1740-
Some(self.alloc_expr_from_pat(Expr::Path(path), ptr))
1737+
.map(|name| name.as_name())
1738+
.map(Path::from)
1739+
.map(|path| {
1740+
self.alloc_expr_from_pat(Expr::Path(path), ptr)
17411741
});
17421742
}
17431743

crates/hir-def/src/hir.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ impl ExprOrPatId {
5959
}
6060

6161
pub fn is_expr(&self) -> bool {
62-
match self {
63-
Self::ExprId(_) => true,
64-
_ => false,
65-
}
62+
matches!(self, Self::ExprId(_))
6663
}
6764

6865
pub fn as_pat(self) -> Option<PatId> {
@@ -73,10 +70,7 @@ impl ExprOrPatId {
7370
}
7471

7572
pub fn is_pat(&self) -> bool {
76-
match self {
77-
Self::PatId(_) => true,
78-
_ => false,
79-
}
73+
matches!(self, Self::PatId(_))
8074
}
8175
}
8276
stdx::impl_from!(ExprId, PatId for ExprOrPatId);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13591359
}
13601360

13611361
fn lower_literal_or_const_to_operand(&mut self, ty: Ty, loc: &ExprId) -> Result<Operand> {
1362-
match dbg!(&self.body.exprs[*loc]) {
1362+
match &self.body.exprs[*loc] {
13631363
Expr::Literal(l) => self.lower_literal_to_operand(ty, l),
13641364
Expr::Path(c) => {
13651365
let edition = self.edition();
@@ -1369,7 +1369,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13691369
.resolver
13701370
.resolve_path_in_value_ns(self.db.upcast(), c, HygieneId::ROOT)
13711371
.ok_or_else(unresolved_name)?;
1372-
dbg!(match dbg!(pr) {
1372+
match pr {
13731373
ResolveValueResult::ValueNs(v, _) => {
13741374
if let ValueNs::ConstId(c) = v {
13751375
self.lower_const_to_operand(Substitution::empty(Interner), c.into(), ty)
@@ -1380,7 +1380,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
13801380
ResolveValueResult::Partial(_, _, _) => {
13811381
not_supported!("associated constants in range pattern")
13821382
}
1383-
})
1383+
}
13841384
}
13851385
_ => {
13861386
not_supported!("only `char` and numeric types are allowed in range patterns");

crates/hir/src/semantics/source_to_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl SourceToDefCtx<'_, '_> {
347347
&mut self,
348348
src: InFile<&ast::IdentPat>,
349349
) -> Option<(DefWithBodyId, BindingId)> {
350-
let container = dbg!(self.find_pat_or_label_container(src.syntax_ref()))?;
350+
let container = self.find_pat_or_label_container(src.syntax_ref())?;
351351
let (body, source_map) = self.db.body_with_source_map(container);
352352
let src = src.cloned().map(ast::Pat::from);
353353
let pat_id = source_map.node_pat(src.as_ref())?;

0 commit comments

Comments
 (0)