diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-08 19:16:05 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-08 19:16:05 +0000 |
commit | c5189a22ccf4c28e309e4189defbb88b83bb2aea (patch) | |
tree | a9eccedac7905ac3b6d6608b4607241ddefe6a63 /crates/ide_assists/src/handlers | |
parent | 8b7e82b012c417ec40a896203ad79f20cf5530ef (diff) | |
parent | 9faf8dd69a819e50b9c973857fe324d7605e2d24 (diff) |
Merge #7923
7923: Remove useless code_model indirection r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_assists/src/handlers')
-rw-r--r-- | crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs | 4 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/qualify_path.rs | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs index 4f0422e96..335e0ed95 100644 --- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use either::Either; | 3 | use either::Either; |
4 | use hir::{AsName, Module, ModuleDef, Name, Variant}; | 4 | use hir::{Module, ModuleDef, Name, Variant}; |
5 | use ide_db::{ | 5 | use ide_db::{ |
6 | defs::Definition, | 6 | defs::Definition, |
7 | helpers::{ | 7 | helpers::{ |
@@ -133,7 +133,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va | |||
133 | ), | 133 | ), |
134 | _ => false, | 134 | _ => false, |
135 | }) | 135 | }) |
136 | .any(|(name, _)| name == variant_name.as_name()) | 136 | .any(|(name, _)| name.to_string() == variant_name.to_string()) |
137 | } | 137 | } |
138 | 138 | ||
139 | fn insert_import( | 139 | fn insert_import( |
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs index b0b0d31b4..d84ca0e55 100644 --- a/crates/ide_assists/src/handlers/qualify_path.rs +++ b/crates/ide_assists/src/handlers/qualify_path.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use hir::{AsAssocItem, AsName}; | 3 | use hir::AsAssocItem; |
4 | use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast}; | 4 | use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast}; |
5 | use ide_db::RootDatabase; | 5 | use ide_db::RootDatabase; |
6 | use syntax::{ | 6 | use syntax::{ |
@@ -160,7 +160,9 @@ fn find_trait_method( | |||
160 | ) -> Option<hir::Function> { | 160 | ) -> Option<hir::Function> { |
161 | if let Some(hir::AssocItem::Function(method)) = | 161 | if let Some(hir::AssocItem::Function(method)) = |
162 | trait_.items(db).into_iter().find(|item: &hir::AssocItem| { | 162 | trait_.items(db).into_iter().find(|item: &hir::AssocItem| { |
163 | item.name(db).map(|name| name == trait_method_name.as_name()).unwrap_or(false) | 163 | item.name(db) |
164 | .map(|name| name.to_string() == trait_method_name.to_string()) | ||
165 | .unwrap_or(false) | ||
164 | }) | 166 | }) |
165 | { | 167 | { |
166 | Some(method) | 168 | Some(method) |