about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--crates/hir-ty/src/mir/eval.rs8
-rw-r--r--crates/hir-ty/src/mir/lower.rs9
-rw-r--r--crates/ide-assists/src/handlers/generate_getter_or_setter.rs6
-rw-r--r--crates/rust-analyzer/src/lsp/to_proto.rs28
-rw-r--r--crates/rust-analyzer/src/main_loop.rs8
-rw-r--r--crates/rust-analyzer/src/reload.rs42
7 files changed, 49 insertions, 53 deletions
diff --git a/Cargo.toml b/Cargo.toml
index e2819016b07..7ec85629cb0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -169,7 +169,6 @@ new_ret_no_self = "allow"
 ## Following lints should be tackled at some point
 borrowed_box = "allow"
 borrow_deref_ref = "allow"
-collapsible_if = "allow"
 collapsible_match = "allow"
 clone_on_copy = "allow"
 derivable_impls = "allow"
diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs
index f8e4c6e43d9..124adf88645 100644
--- a/crates/hir-ty/src/mir/eval.rs
+++ b/crates/hir-ty/src/mir/eval.rs
@@ -1842,10 +1842,10 @@ impl Evaluator<'_> {
             }
         }
         let layout = self.layout(ty);
-        if self.assert_placeholder_ty_is_unused {
-            if matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _))) {
-                return Ok(Some((0, 1)));
-            }
+        if self.assert_placeholder_ty_is_unused
+            && matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _)))
+        {
+            return Ok(Some((0, 1)));
         }
         let layout = layout?;
         Ok(layout
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 169e0e204c5..d320dcdad28 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -948,10 +948,11 @@ impl<'ctx> MirLowerCtx<'ctx> {
                     // for binary operator, and use without adjust to simplify our conditions.
                     let lhs_ty = self.expr_ty_without_adjust(*lhs);
                     let rhs_ty = self.expr_ty_without_adjust(*rhs);
-                    if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. })) {
-                        if lhs_ty.as_raw_ptr().is_some() && rhs_ty.as_raw_ptr().is_some() {
-                            break 'b true;
-                        }
+                    if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. }))
+                        && lhs_ty.as_raw_ptr().is_some()
+                        && rhs_ty.as_raw_ptr().is_some()
+                    {
+                        break 'b true;
                     }
                     let builtin_inequal_impls = matches!(
                         op,
diff --git a/crates/ide-assists/src/handlers/generate_getter_or_setter.rs b/crates/ide-assists/src/handlers/generate_getter_or_setter.rs
index 596e277e0f0..79307fcec5a 100644
--- a/crates/ide-assists/src/handlers/generate_getter_or_setter.rs
+++ b/crates/ide-assists/src/handlers/generate_getter_or_setter.rs
@@ -377,10 +377,8 @@ fn build_source_change(
         };
 
         // Insert `$0` only for last getter we generate
-        if i == record_fields_count - 1 {
-            if ctx.config.snippet_cap.is_some() {
-                getter_buf = getter_buf.replacen("fn ", "fn $0", 1);
-            }
+        if i == record_fields_count - 1 && ctx.config.snippet_cap.is_some() {
+            getter_buf = getter_buf.replacen("fn ", "fn $0", 1);
         }
 
         // For first element we do not merge with '\n', as
diff --git a/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs
index d26fe16cbd3..fe381fbeb3f 100644
--- a/crates/rust-analyzer/src/lsp/to_proto.rs
+++ b/crates/rust-analyzer/src/lsp/to_proto.rs
@@ -310,22 +310,20 @@ fn completion_item(
 
     set_score(&mut lsp_item, max_relevance, item.relevance);
 
-    if config.completion().enable_imports_on_the_fly {
-        if !item.import_to_add.is_empty() {
-            let imports: Vec<_> = item
-                .import_to_add
-                .into_iter()
-                .filter_map(|(import_path, import_name)| {
-                    Some(lsp_ext::CompletionImport {
-                        full_import_path: import_path,
-                        imported_name: import_name,
-                    })
+    if config.completion().enable_imports_on_the_fly && !item.import_to_add.is_empty() {
+        let imports: Vec<_> = item
+            .import_to_add
+            .into_iter()
+            .filter_map(|(import_path, import_name)| {
+                Some(lsp_ext::CompletionImport {
+                    full_import_path: import_path,
+                    imported_name: import_name,
                 })
-                .collect();
-            if !imports.is_empty() {
-                let data = lsp_ext::CompletionResolveData { position: tdpp.clone(), imports };
-                lsp_item.data = Some(to_value(data).unwrap());
-            }
+            })
+            .collect();
+        if !imports.is_empty() {
+            let data = lsp_ext::CompletionResolveData { position: tdpp.clone(), imports };
+            lsp_item.data = Some(to_value(data).unwrap());
         }
     }
 
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index f7675856970..0173805d447 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -579,10 +579,10 @@ impl GlobalState {
                     let path = VfsPath::from(path);
                     // if the file is in mem docs, it's managed by the client via notifications
                     // so only set it if its not in there
-                    if !self.mem_docs.contains(&path) {
-                        if is_changed || vfs.file_id(&path).is_none() {
-                            vfs.set_file_contents(path, contents);
-                        }
+                    if !self.mem_docs.contains(&path)
+                        && (is_changed || vfs.file_id(&path).is_none())
+                    {
+                        vfs.set_file_contents(path, contents);
                     }
                 }
             }
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 83736c65ed3..b64936e799f 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -454,27 +454,27 @@ impl GlobalState {
         let files_config = self.config.files();
         let project_folders = ProjectFolders::new(&self.workspaces, &files_config.exclude);
 
-        if self.proc_macro_clients.is_empty() || !same_workspaces {
-            if self.config.expand_proc_macros() {
-                tracing::info!("Spawning proc-macro servers");
-
-                self.proc_macro_clients = Arc::from_iter(self.workspaces.iter().map(|ws| {
-                    let path = match self.config.proc_macro_srv() {
-                        Some(path) => path,
-                        None => ws.find_sysroot_proc_macro_srv()?,
-                    };
-
-                    tracing::info!("Using proc-macro server at {path}");
-                    ProcMacroServer::spawn(path.clone()).map_err(|err| {
-                        tracing::error!(
-                            "Failed to run proc-macro server from path {path}, error: {err:?}",
-                        );
-                        anyhow::format_err!(
-                            "Failed to run proc-macro server from path {path}, error: {err:?}",
-                        )
-                    })
-                }))
-            };
+        if (self.proc_macro_clients.is_empty() || !same_workspaces)
+            && self.config.expand_proc_macros()
+        {
+            tracing::info!("Spawning proc-macro servers");
+
+            self.proc_macro_clients = Arc::from_iter(self.workspaces.iter().map(|ws| {
+                let path = match self.config.proc_macro_srv() {
+                    Some(path) => path,
+                    None => ws.find_sysroot_proc_macro_srv()?,
+                };
+
+                tracing::info!("Using proc-macro server at {path}");
+                ProcMacroServer::spawn(path.clone()).map_err(|err| {
+                    tracing::error!(
+                        "Failed to run proc-macro server from path {path}, error: {err:?}",
+                    );
+                    anyhow::format_err!(
+                        "Failed to run proc-macro server from path {path}, error: {err:?}",
+                    )
+                })
+            }))
         }
 
         let watch = match files_config.watcher {