mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
feat: add remove_slice
to hir::Type
This commit is contained in:
parent
9549753352
commit
34e3ea8cc8
1 changed files with 7 additions and 0 deletions
|
@ -3224,6 +3224,13 @@ impl Type {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn remove_slice(&self) -> Option<Type> {
|
||||
match &self.ty.kind(Interner) {
|
||||
TyKind::Slice(ty) => Some(self.derived(ty.clone())),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn strip_references(&self) -> Type {
|
||||
self.derived(self.ty.strip_references().clone())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue