mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
7709: Added the check for return type of len function.
This commit is contained in:
parent
c0a2b4e826
commit
714836959b
2 changed files with 33 additions and 9 deletions
|
@ -1631,6 +1631,13 @@ impl Type {
|
|||
matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
|
||||
}
|
||||
|
||||
pub fn is_usize(&self) -> bool {
|
||||
matches!(
|
||||
self.ty.value.interned(&Interner),
|
||||
TyKind::Scalar(Scalar::Uint(hir_ty::primitive::UintTy::Usize))
|
||||
)
|
||||
}
|
||||
|
||||
pub fn remove_ref(&self) -> Option<Type> {
|
||||
match &self.ty.value.interned(&Interner) {
|
||||
TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue