Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-diagnostics/src/handlers/json_is_not_rust.rs')
-rw-r--r--crates/ide-diagnostics/src/handlers/json_is_not_rust.rs50
1 files changed, 20 insertions, 30 deletions
diff --git a/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs b/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs
index bf7dddacd8..742d614bc5 100644
--- a/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs
+++ b/crates/ide-diagnostics/src/handlers/json_is_not_rust.rs
@@ -148,37 +148,27 @@ pub(crate) fn json_in_items(
allow_unstable: true,
};
- if !scope_has("Serialize") {
- if let Some(PathResolution::Def(it)) = serialize_resolved {
- if let Some(it) = current_module.find_use_path(
- sema.db,
- it,
- config.insert_use.prefix_kind,
- cfg,
- ) {
- insert_use(
- &scope,
- mod_path_to_ast(&it, edition),
- &config.insert_use,
- );
- }
- }
+ if !scope_has("Serialize")
+ && let Some(PathResolution::Def(it)) = serialize_resolved
+ && let Some(it) = current_module.find_use_path(
+ sema.db,
+ it,
+ config.insert_use.prefix_kind,
+ cfg,
+ )
+ {
+ insert_use(&scope, mod_path_to_ast(&it, edition), &config.insert_use);
}
- if !scope_has("Deserialize") {
- if let Some(PathResolution::Def(it)) = deserialize_resolved {
- if let Some(it) = current_module.find_use_path(
- sema.db,
- it,
- config.insert_use.prefix_kind,
- cfg,
- ) {
- insert_use(
- &scope,
- mod_path_to_ast(&it, edition),
- &config.insert_use,
- );
- }
- }
+ if !scope_has("Deserialize")
+ && let Some(PathResolution::Def(it)) = deserialize_resolved
+ && let Some(it) = current_module.find_use_path(
+ sema.db,
+ it,
+ config.insert_use.prefix_kind,
+ cfg,
+ )
+ {
+ insert_use(&scope, mod_path_to_ast(&it, edition), &config.insert_use);
}
let mut sc = scb.finish();
sc.insert_source_edit(vfs_file_id, edit.finish());