File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,21 @@ pub(crate) fn deref(
35
35
krate : CrateId ,
36
36
ty : InEnvironment < & Canonical < Ty > > ,
37
37
) -> Option < Canonical < Ty > > {
38
- if let Some ( derefed) = ty. goal . value . builtin_deref ( ) {
38
+ if let Some ( derefed) = builtin_deref ( & ty. goal . value ) {
39
39
Some ( Canonical { value : derefed, binders : ty. goal . binders . clone ( ) } )
40
40
} else {
41
41
deref_by_trait ( db, krate, ty)
42
42
}
43
43
}
44
44
45
+ fn builtin_deref ( ty : & Ty ) -> Option < Ty > {
46
+ match ty. kind ( & Interner ) {
47
+ TyKind :: Ref ( .., ty) => Some ( ty. clone ( ) ) ,
48
+ TyKind :: Raw ( .., ty) => Some ( ty. clone ( ) ) ,
49
+ _ => None ,
50
+ }
51
+ }
52
+
45
53
fn deref_by_trait (
46
54
db : & dyn HirDatabase ,
47
55
krate : CrateId ,
Original file line number Diff line number Diff line change @@ -199,14 +199,6 @@ impl Ty {
199
199
}
200
200
}
201
201
202
- fn builtin_deref ( & self ) -> Option < Ty > {
203
- match self . kind ( & Interner ) {
204
- TyKind :: Ref ( .., ty) => Some ( ty. clone ( ) ) ,
205
- TyKind :: Raw ( .., ty) => Some ( ty. clone ( ) ) ,
206
- _ => None ,
207
- }
208
- }
209
-
210
202
/// Returns the type parameters of this type if it has some (i.e. is an ADT
211
203
/// or function); so if `self` is `Option<u32>`, this returns the `u32`.
212
204
pub fn substs ( & self ) -> Option < & Substitution > {
You can’t perform that action at this time.
0 commit comments