diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-22 14:17:06 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-22 14:17:06 +0000 |
commit | 655b4f16f04689ef7957c5a3282a4ed5a8ef6016 (patch) | |
tree | bce7301baad49d8abb15c0a7e3ab7c30beda5c15 /crates/ra_hir | |
parent | 6fe956420fc63609a84dd005b8190b1f19fff280 (diff) | |
parent | bfb6e3fd836650dd477c55e6642d831028f30b22 (diff) |
Merge #3679
3679: Some miniscule refactorings r=matklad a=Veetaha
Co-authored-by: veetaha <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 24 |
1 files changed, 6 insertions, 18 deletions
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`. |