diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 19:29:21 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 19:29:21 +0100 |
commit | 215b9b9cccd66c9e9413e7581931371daa0c94e5 (patch) | |
tree | 342258c6744a6ec8189b9910f2b3bb7efd73f06b /crates/ra_assists/src | |
parent | 38ab326aac70484cb951fe9389d788d525d41550 (diff) | |
parent | af53d5f4b081ad50d8fe08fc1e107aa6025b2491 (diff) |
Merge #5632
5632: Cleanup impl gramamr r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/ast_transform.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/utils.rs | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 0a7be87a0..28f3f3546 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs | |||
@@ -81,7 +81,7 @@ impl<'a> SubstituteTypeParams<'a> { | |||
81 | // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the | 81 | // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the |
82 | // trait ref, and then go from the types in the substs back to the syntax). | 82 | // trait ref, and then go from the types in the substs back to the syntax). |
83 | fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> { | 83 | fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> { |
84 | let target_trait = impl_def.target_trait()?; | 84 | let target_trait = impl_def.trait_()?; |
85 | let path_type = match target_trait { | 85 | let path_type = match target_trait { |
86 | ast::Type::PathType(path) => path, | 86 | ast::Type::PathType(path) => path, |
87 | _ => return None, | 87 | _ => return None, |
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index bb16ebd4e..373de273c 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -111,11 +111,8 @@ pub(crate) fn resolve_target_trait( | |||
111 | sema: &Semantics<RootDatabase>, | 111 | sema: &Semantics<RootDatabase>, |
112 | impl_def: &ast::Impl, | 112 | impl_def: &ast::Impl, |
113 | ) -> Option<hir::Trait> { | 113 | ) -> Option<hir::Trait> { |
114 | let ast_path = impl_def | 114 | let ast_path = |
115 | .target_trait() | 115 | impl_def.trait_().map(|it| it.syntax().clone()).and_then(ast::PathType::cast)?.path()?; |
116 | .map(|it| it.syntax().clone()) | ||
117 | .and_then(ast::PathType::cast)? | ||
118 | .path()?; | ||
119 | 116 | ||
120 | match sema.resolve_path(&ast_path) { | 117 | match sema.resolve_path(&ast_path) { |
121 | Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def), | 118 | Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def), |