Unnamed repository; edit this file 'description' to name the repository.
Fix clippy errors
Ali Bektas 2025-02-09
parent 419231c · commit 76b93c0
-rw-r--r--crates/hir-def/src/expr_store/lower.rs8
-rw-r--r--crates/hir-def/src/hir.rs10
-rw-r--r--crates/hir-ty/src/mir/lower.rs6
-rw-r--r--crates/hir/src/semantics/source_to_def.rs2
4 files changed, 10 insertions, 16 deletions
diff --git a/crates/hir-def/src/expr_store/lower.rs b/crates/hir-def/src/expr_store/lower.rs
index 2be7b9963b..95dd1e53ae 100644
--- a/crates/hir-def/src/expr_store/lower.rs
+++ b/crates/hir-def/src/expr_store/lower.rs
@@ -1802,10 +1802,10 @@ impl ExprCollector<'_> {
if ident.is_simple_ident() {
return ident
.name()
- .and_then(|name| Some(name.as_name()))
- .and_then(|hir_name| Some(Path::from(hir_name)))
- .and_then(|path| {
- Some(self.alloc_expr_from_pat(Expr::Path(path), ptr))
+ .map(|name| name.as_name())
+ .map(Path::from)
+ .map(|path| {
+ self.alloc_expr_from_pat(Expr::Path(path), ptr)
});
}
diff --git a/crates/hir-def/src/hir.rs b/crates/hir-def/src/hir.rs
index 6aca610a93..494644d8ef 100644
--- a/crates/hir-def/src/hir.rs
+++ b/crates/hir-def/src/hir.rs
@@ -56,10 +56,7 @@ impl ExprOrPatId {
}
pub fn is_expr(&self) -> bool {
- match self {
- Self::ExprId(_) => true,
- _ => false,
- }
+ matches!(self, Self::ExprId(_))
}
pub fn as_pat(self) -> Option<PatId> {
@@ -70,10 +67,7 @@ impl ExprOrPatId {
}
pub fn is_pat(&self) -> bool {
- match self {
- Self::PatId(_) => true,
- _ => false,
- }
+ matches!(self, Self::PatId(_))
}
}
stdx::impl_from!(ExprId, PatId for ExprOrPatId);
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 69b3b9c02a..f3f564459d 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -1359,7 +1359,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
}
fn lower_literal_or_const_to_operand(&mut self, ty: Ty, loc: &ExprId) -> Result<Operand> {
- match dbg!(&self.body.exprs[*loc]) {
+ match &self.body.exprs[*loc] {
Expr::Literal(l) => self.lower_literal_to_operand(ty, l),
Expr::Path(c) => {
let edition = self.edition();
@@ -1369,7 +1369,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
.resolver
.resolve_path_in_value_ns(self.db.upcast(), c, HygieneId::ROOT)
.ok_or_else(unresolved_name)?;
- dbg!(match dbg!(pr) {
+ match pr {
ResolveValueResult::ValueNs(v, _) => {
if let ValueNs::ConstId(c) = v {
self.lower_const_to_operand(Substitution::empty(Interner), c.into(), ty)
@@ -1380,7 +1380,7 @@ impl<'ctx> MirLowerCtx<'ctx> {
ResolveValueResult::Partial(_, _, _) => {
not_supported!("associated constants in range pattern")
}
- })
+ }
}
_ => {
not_supported!("only `char` and numeric types are allowed in range patterns");
diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs
index 227a60bee2..29d3736bae 100644
--- a/crates/hir/src/semantics/source_to_def.rs
+++ b/crates/hir/src/semantics/source_to_def.rs
@@ -347,7 +347,7 @@ impl SourceToDefCtx<'_, '_> {
&mut self,
src: InFile<&ast::IdentPat>,
) -> Option<(DefWithBodyId, BindingId)> {
- let container = dbg!(self.find_pat_or_label_container(src.syntax_ref()))?;
+ let container = self.find_pat_or_label_container(src.syntax_ref())?;
let (body, source_map) = self.db.body_with_source_map(container);
let src = src.cloned().map(ast::Pat::from);
let pat_id = source_map.node_pat(src.as_ref())?;