Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--Cargo.toml1
-rw-r--r--crates/hir-def/src/db.rs6
-rw-r--r--crates/hir-def/src/import_map.rs8
-rw-r--r--crates/hir-ty/src/mir/eval.rs8
-rw-r--r--crates/hir/src/lib.rs14
-rw-r--r--crates/ide-assists/src/utils/suggest_name.rs8
-rw-r--r--crates/ide-completion/src/context.rs9
-rw-r--r--crates/ide-completion/src/render/literal.rs10
-rw-r--r--crates/ide-db/src/symbol_index.rs8
9 files changed, 29 insertions, 43 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 18ed8a162b..494eb18c80 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -175,7 +175,6 @@ field_reassign_with_default = "allow"
forget_non_drop = "allow"
format_collect = "allow"
large_enum_variant = "allow"
-match_like_matches_macro = "allow"
match_single_binding = "allow"
needless_borrow = "allow"
needless_doctest_main = "allow"
diff --git a/crates/hir-def/src/db.rs b/crates/hir-def/src/db.rs
index d25d41c2cf..c9789ceb20 100644
--- a/crates/hir-def/src/db.rs
+++ b/crates/hir-def/src/db.rs
@@ -259,10 +259,8 @@ fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: CrateId) -> bool {
None => continue,
};
- let segments = tt.split(|tt| match tt {
- tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ',' => true,
- _ => false,
- });
+ let segments =
+ tt.split(|tt| matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ','));
for output in segments.skip(1) {
match output {
[tt::TokenTree::Leaf(tt::Leaf::Ident(ident))] if ident.text == "no_std" => {
diff --git a/crates/hir-def/src/import_map.rs b/crates/hir-def/src/import_map.rs
index 989bbc7bfb..7b38a2041b 100644
--- a/crates/hir-def/src/import_map.rs
+++ b/crates/hir-def/src/import_map.rs
@@ -382,11 +382,11 @@ impl Query {
}
fn matches_assoc_mode(&self, is_trait_assoc_item: IsTraitAssocItem) -> bool {
- match (is_trait_assoc_item, self.assoc_mode) {
+ !matches!(
+ (is_trait_assoc_item, self.assoc_mode),
(IsTraitAssocItem::Yes, AssocSearchMode::Exclude)
- | (IsTraitAssocItem::No, AssocSearchMode::AssocItemsOnly) => false,
- _ => true,
- }
+ | (IsTraitAssocItem::No, AssocSearchMode::AssocItemsOnly)
+ )
}
}
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index 41d0da5be7..85caf0f58c 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -1387,10 +1387,10 @@ impl Evaluator<'_> {
| CastKind::PointerExposeAddress
| CastKind::PointerFromExposedAddress => {
let current_ty = self.operand_ty(operand, locals)?;
- let is_signed = match current_ty.kind(Interner) {
- TyKind::Scalar(chalk_ir::Scalar::Int(_)) => true,
- _ => false,
- };
+ let is_signed = matches!(
+ current_ty.kind(Interner),
+ TyKind::Scalar(chalk_ir::Scalar::Int(_))
+ );
let current = pad16(self.eval_operand(operand, locals)?.get(self)?, is_signed);
let dest_size =
self.size_of_sized(target_ty, locals, "destination of int to int cast")?;
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d48df7ca68..5d42f7e07c 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -2495,14 +2495,7 @@ impl Trait {
db.generic_params(GenericDefId::from(self.id))
.type_or_consts
.iter()
- .filter(|(_, ty)| match ty {
- TypeOrConstParamData::TypeParamData(ty)
- if ty.provenance != TypeParamProvenance::TypeParamList =>
- {
- false
- }
- _ => true,
- })
+ .filter(|(_, ty)| !matches!(ty, TypeOrConstParamData::TypeParamData(ty) if ty.provenance != TypeParamProvenance::TypeParamList))
.filter(|(_, ty)| !count_required_only || !ty.has_default())
.count()
}
@@ -3872,10 +3865,7 @@ impl Type {
}
pub fn is_int_or_uint(&self) -> bool {
- match self.ty.kind(Interner) {
- TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)) => true,
- _ => false,
- }
+ matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)))
}
pub fn is_scalar(&self) -> bool {
diff --git a/crates/ide-assists/src/utils/suggest_name.rs b/crates/ide-assists/src/utils/suggest_name.rs
index b4c6cbff2a..78dee24a6d 100644
--- a/crates/ide-assists/src/utils/suggest_name.rs
+++ b/crates/ide-assists/src/utils/suggest_name.rs
@@ -185,10 +185,10 @@ fn normalize(name: &str) -> Option<String> {
}
fn is_valid_name(name: &str) -> bool {
- match ide_db::syntax_helpers::LexedStr::single_token(name) {
- Some((syntax::SyntaxKind::IDENT, _error)) => true,
- _ => false,
- }
+ matches!(
+ ide_db::syntax_helpers::LexedStr::single_token(name),
+ Some((syntax::SyntaxKind::IDENT, _error))
+ )
}
fn is_useless_method(method: &ast::MethodCallExpr) -> bool {
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index 92aa1da89c..575f524209 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -186,14 +186,13 @@ impl TypeLocation {
}
pub(crate) fn complete_consts(&self) -> bool {
- match self {
+ matches!(
+ self,
TypeLocation::GenericArg {
corresponding_param: Some(ast::GenericParam::ConstParam(_)),
..
- } => true,
- TypeLocation::AssocConstEq => true,
- _ => false,
- }
+ } | TypeLocation::AssocConstEq
+ )
}
pub(crate) fn complete_types(&self) -> bool {
diff --git a/crates/ide-completion/src/render/literal.rs b/crates/ide-completion/src/render/literal.rs
index b218502f7f..f2d67df01d 100644
--- a/crates/ide-completion/src/render/literal.rs
+++ b/crates/ide-completion/src/render/literal.rs
@@ -57,11 +57,11 @@ fn render(
) -> Option<Builder> {
let db = completion.db;
let mut kind = thing.kind(db);
- let should_add_parens = match &path_ctx {
- PathCompletionCtx { has_call_parens: true, .. } => false,
- PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. } => false,
- _ => true,
- };
+ let should_add_parens = !matches!(
+ path_ctx,
+ PathCompletionCtx { has_call_parens: true, .. }
+ | PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. }
+ );
let fields = thing.fields(completion)?;
let (qualified_name, short_qualified_name, qualified) = match path {
diff --git a/crates/ide-db/src/symbol_index.rs b/crates/ide-db/src/symbol_index.rs
index e8a3c11dce..7774b0834d 100644
--- a/crates/ide-db/src/symbol_index.rs
+++ b/crates/ide-db/src/symbol_index.rs
@@ -383,10 +383,10 @@ impl Query {
}
fn matches_assoc_mode(&self, is_trait_assoc_item: bool) -> bool {
- match (is_trait_assoc_item, self.assoc_mode) {
- (true, AssocSearchMode::Exclude) | (false, AssocSearchMode::AssocItemsOnly) => false,
- _ => true,
- }
+ !matches!(
+ (is_trait_assoc_item, self.assoc_mode),
+ (true, AssocSearchMode::Exclude) | (false, AssocSearchMode::AssocItemsOnly)
+ )
}
}