match_like_matches_macro
This commit is contained in:
parent
2ae2512378
commit
add40c8660
@ -175,7 +175,6 @@ field_reassign_with_default = "allow"
|
|||||||
forget_non_drop = "allow"
|
forget_non_drop = "allow"
|
||||||
format_collect = "allow"
|
format_collect = "allow"
|
||||||
large_enum_variant = "allow"
|
large_enum_variant = "allow"
|
||||||
match_like_matches_macro = "allow"
|
|
||||||
match_single_binding = "allow"
|
match_single_binding = "allow"
|
||||||
needless_borrow = "allow"
|
needless_borrow = "allow"
|
||||||
needless_doctest_main = "allow"
|
needless_doctest_main = "allow"
|
||||||
|
@ -259,10 +259,8 @@ fn crate_supports_no_std(db: &dyn DefDatabase, crate_id: CrateId) -> bool {
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let segments = tt.split(|tt| match tt {
|
let segments =
|
||||||
tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ',' => true,
|
tt.split(|tt| matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ','));
|
||||||
_ => false,
|
|
||||||
});
|
|
||||||
for output in segments.skip(1) {
|
for output in segments.skip(1) {
|
||||||
match output {
|
match output {
|
||||||
[tt::TokenTree::Leaf(tt::Leaf::Ident(ident))] if ident.text == "no_std" => {
|
[tt::TokenTree::Leaf(tt::Leaf::Ident(ident))] if ident.text == "no_std" => {
|
||||||
|
@ -382,11 +382,11 @@ impl Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn matches_assoc_mode(&self, is_trait_assoc_item: IsTraitAssocItem) -> bool {
|
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::Yes, AssocSearchMode::Exclude)
|
||||||
| (IsTraitAssocItem::No, AssocSearchMode::AssocItemsOnly) => false,
|
| (IsTraitAssocItem::No, AssocSearchMode::AssocItemsOnly)
|
||||||
_ => true,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1387,10 +1387,10 @@ impl Evaluator<'_> {
|
|||||||
| CastKind::PointerExposeAddress
|
| CastKind::PointerExposeAddress
|
||||||
| CastKind::PointerFromExposedAddress => {
|
| CastKind::PointerFromExposedAddress => {
|
||||||
let current_ty = self.operand_ty(operand, locals)?;
|
let current_ty = self.operand_ty(operand, locals)?;
|
||||||
let is_signed = match current_ty.kind(Interner) {
|
let is_signed = matches!(
|
||||||
TyKind::Scalar(chalk_ir::Scalar::Int(_)) => true,
|
current_ty.kind(Interner),
|
||||||
_ => false,
|
TyKind::Scalar(chalk_ir::Scalar::Int(_))
|
||||||
};
|
);
|
||||||
let current = pad16(self.eval_operand(operand, locals)?.get(self)?, is_signed);
|
let current = pad16(self.eval_operand(operand, locals)?.get(self)?, is_signed);
|
||||||
let dest_size =
|
let dest_size =
|
||||||
self.size_of_sized(target_ty, locals, "destination of int to int cast")?;
|
self.size_of_sized(target_ty, locals, "destination of int to int cast")?;
|
||||||
|
@ -2495,14 +2495,7 @@ impl Trait {
|
|||||||
db.generic_params(GenericDefId::from(self.id))
|
db.generic_params(GenericDefId::from(self.id))
|
||||||
.type_or_consts
|
.type_or_consts
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(_, ty)| match ty {
|
.filter(|(_, ty)| !matches!(ty, TypeOrConstParamData::TypeParamData(ty) if ty.provenance != TypeParamProvenance::TypeParamList))
|
||||||
TypeOrConstParamData::TypeParamData(ty)
|
|
||||||
if ty.provenance != TypeParamProvenance::TypeParamList =>
|
|
||||||
{
|
|
||||||
false
|
|
||||||
}
|
|
||||||
_ => true,
|
|
||||||
})
|
|
||||||
.filter(|(_, ty)| !count_required_only || !ty.has_default())
|
.filter(|(_, ty)| !count_required_only || !ty.has_default())
|
||||||
.count()
|
.count()
|
||||||
}
|
}
|
||||||
@ -3872,10 +3865,7 @@ impl Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_int_or_uint(&self) -> bool {
|
pub fn is_int_or_uint(&self) -> bool {
|
||||||
match self.ty.kind(Interner) {
|
matches!(self.ty.kind(Interner), TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)))
|
||||||
TyKind::Scalar(Scalar::Int(_) | Scalar::Uint(_)) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_scalar(&self) -> bool {
|
pub fn is_scalar(&self) -> bool {
|
||||||
|
@ -185,10 +185,10 @@ fn normalize(name: &str) -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_valid_name(name: &str) -> bool {
|
fn is_valid_name(name: &str) -> bool {
|
||||||
match ide_db::syntax_helpers::LexedStr::single_token(name) {
|
matches!(
|
||||||
Some((syntax::SyntaxKind::IDENT, _error)) => true,
|
ide_db::syntax_helpers::LexedStr::single_token(name),
|
||||||
_ => false,
|
Some((syntax::SyntaxKind::IDENT, _error))
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_useless_method(method: &ast::MethodCallExpr) -> bool {
|
fn is_useless_method(method: &ast::MethodCallExpr) -> bool {
|
||||||
|
@ -186,14 +186,13 @@ impl TypeLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn complete_consts(&self) -> bool {
|
pub(crate) fn complete_consts(&self) -> bool {
|
||||||
match self {
|
matches!(
|
||||||
|
self,
|
||||||
TypeLocation::GenericArg {
|
TypeLocation::GenericArg {
|
||||||
corresponding_param: Some(ast::GenericParam::ConstParam(_)),
|
corresponding_param: Some(ast::GenericParam::ConstParam(_)),
|
||||||
..
|
..
|
||||||
} => true,
|
} | TypeLocation::AssocConstEq
|
||||||
TypeLocation::AssocConstEq => true,
|
)
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn complete_types(&self) -> bool {
|
pub(crate) fn complete_types(&self) -> bool {
|
||||||
|
@ -57,11 +57,11 @@ fn render(
|
|||||||
) -> Option<Builder> {
|
) -> Option<Builder> {
|
||||||
let db = completion.db;
|
let db = completion.db;
|
||||||
let mut kind = thing.kind(db);
|
let mut kind = thing.kind(db);
|
||||||
let should_add_parens = match &path_ctx {
|
let should_add_parens = !matches!(
|
||||||
PathCompletionCtx { has_call_parens: true, .. } => false,
|
path_ctx,
|
||||||
PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. } => false,
|
PathCompletionCtx { has_call_parens: true, .. }
|
||||||
_ => true,
|
| PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. }
|
||||||
};
|
);
|
||||||
|
|
||||||
let fields = thing.fields(completion)?;
|
let fields = thing.fields(completion)?;
|
||||||
let (qualified_name, short_qualified_name, qualified) = match path {
|
let (qualified_name, short_qualified_name, qualified) = match path {
|
||||||
|
@ -383,10 +383,10 @@ impl Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn matches_assoc_mode(&self, is_trait_assoc_item: bool) -> bool {
|
fn matches_assoc_mode(&self, is_trait_assoc_item: bool) -> bool {
|
||||||
match (is_trait_assoc_item, self.assoc_mode) {
|
!matches!(
|
||||||
(true, AssocSearchMode::Exclude) | (false, AssocSearchMode::AssocItemsOnly) => false,
|
(is_trait_assoc_item, self.assoc_mode),
|
||||||
_ => true,
|
(true, AssocSearchMode::Exclude) | (false, AssocSearchMode::AssocItemsOnly)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user