aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock13
-rw-r--r--crates/ra_hir/src/code_model.rs24
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs16
3 files changed, 18 insertions, 35 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 3f4d9204c..f8d26192d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -845,14 +845,9 @@ checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
845 845
846[[package]] 846[[package]]
847name = "proc-macro-hack" 847name = "proc-macro-hack"
848version = "0.5.12" 848version = "0.5.14"
849source = "registry+https://github.com/rust-lang/crates.io-index" 849source = "registry+https://github.com/rust-lang/crates.io-index"
850checksum = "f918f2b601f93baa836c1c2945faef682ba5b6d4828ecb45eeb7cc3c71b811b4" 850checksum = "fcfdefadc3d57ca21cf17990a28ef4c0f7c61383a28cb7604cf4a18e6ede1420"
851dependencies = [
852 "proc-macro2",
853 "quote",
854 "syn",
855]
856 851
857[[package]] 852[[package]]
858name = "proc-macro2" 853name = "proc-macro2"
@@ -1480,9 +1475,9 @@ checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f"
1480 1475
1481[[package]] 1476[[package]]
1482name = "syn" 1477name = "syn"
1483version = "1.0.16" 1478version = "1.0.17"
1484source = "registry+https://github.com/rust-lang/crates.io-index" 1479source = "registry+https://github.com/rust-lang/crates.io-index"
1485checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859" 1480checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
1486dependencies = [ 1481dependencies = [
1487 "proc-macro2", 1482 "proc-macro2",
1488 "quote", 1483 "quote",
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 45e31095c..4b150ef06 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1042,30 +1042,18 @@ impl Type {
1042 } 1042 }
1043 1043
1044 pub fn is_bool(&self) -> bool { 1044 pub fn is_bool(&self) -> bool {
1045 match &self.ty.value { 1045 matches!(self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::Bool, .. }))
1046 Ty::Apply(a_ty) => match a_ty.ctor {
1047 TypeCtor::Bool => true,
1048 _ => false,
1049 },
1050 _ => false,
1051 }
1052 } 1046 }
1053 1047
1054 pub fn is_mutable_reference(&self) -> bool { 1048 pub fn is_mutable_reference(&self) -> bool {
1055 match &self.ty.value { 1049 matches!(
1056 Ty::Apply(a_ty) => match a_ty.ctor { 1050 self.ty.value,
1057 TypeCtor::Ref(Mutability::Mut) => true, 1051 Ty::Apply(ApplicationTy { ctor: TypeCtor::Ref(Mutability::Mut), .. })
1058 _ => false, 1052 )
1059 },
1060 _ => false,
1061 }
1062 } 1053 }
1063 1054
1064 pub fn is_unknown(&self) -> bool { 1055 pub fn is_unknown(&self) -> bool {
1065 match &self.ty.value { 1056 matches!(self.ty.value, Ty::Unknown)
1066 Ty::Unknown => true,
1067 _ => false,
1068 }
1069 } 1057 }
1070 1058
1071 /// Checks that particular type `ty` implements `std::future::Future`. 1059 /// Checks that particular type `ty` implements `std::future::Future`.
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs
index 69c059ac8..533c6ccfb 100644
--- a/crates/ra_hir_ty/src/method_resolution.rs
+++ b/crates/ra_hir_ty/src/method_resolution.rs
@@ -95,14 +95,14 @@ impl Ty {
95 // Types like slice can have inherent impls in several crates, (core and alloc). 95 // Types like slice can have inherent impls in several crates, (core and alloc).
96 // The corresponding impls are marked with lang items, so we can use them to find the required crates. 96 // The corresponding impls are marked with lang items, so we can use them to find the required crates.
97 macro_rules! lang_item_crate { 97 macro_rules! lang_item_crate {
98 ($($name:expr),+ $(,)?) => {{ 98 ($($name:expr),+ $(,)?) => {{
99 let mut v = ArrayVec::<[LangItemTarget; 2]>::new(); 99 let mut v = ArrayVec::<[LangItemTarget; 2]>::new();
100 $( 100 $(
101 v.extend(db.lang_item(cur_crate, $name.into())); 101 v.extend(db.lang_item(cur_crate, $name.into()));
102 )+ 102 )+
103 v 103 v
104 }}; 104 }};
105 } 105 }
106 106
107 let lang_item_targets = match self { 107 let lang_item_targets = match self {
108 Ty::Apply(a_ty) => match a_ty.ctor { 108 Ty::Apply(a_ty) => match a_ty.ctor {