about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohann Hemmann <johann.hemmann@code.berlin>2024-01-22 02:15:29 +0100
committerJohann Hemmann <johann.hemmann@code.berlin>2024-01-31 19:06:18 +0100
commit04ccef80cbe066ab0228fc93ccba159f47a2a5f0 (patch)
treee473aa71a0719baf563d3745d8f503ccbf5de3ed
parentdd9f27b8d361180d6df350ac95087d739e3e9023 (diff)
downloadrust-04ccef80cbe066ab0228fc93ccba159f47a2a5f0.tar.gz
rust-04ccef80cbe066ab0228fc93ccba159f47a2a5f0.zip
field_reassign_with_default
-rw-r--r--Cargo.toml1
-rw-r--r--crates/ide/src/hover.rs1
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs12
-rw-r--r--crates/rust-analyzer/src/cli/diagnostics.rs4
-rw-r--r--crates/rust-analyzer/src/cli/lsif.rs4
-rw-r--r--crates/rust-analyzer/src/cli/run_tests.rs4
-rw-r--r--crates/rust-analyzer/src/cli/rustc_tests.rs4
-rw-r--r--crates/rust-analyzer/src/cli/ssr.rs4
8 files changed, 18 insertions, 16 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d29f46ca2b5..7eb5ab9d618 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -168,7 +168,6 @@ new_ret_no_self = "allow"
 ## Following lints should be tackled at some point
 borrowed_box = "allow"
 derived_hash_with_manual_eq = "allow"
-field_reassign_with_default = "allow"
 forget_non_drop = "allow"
 format_collect = "allow"
 large_enum_variant = "allow"
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 77a06a97e22..19b181ae3b6 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -120,6 +120,7 @@ pub(crate) fn hover(
     Some(res)
 }
 
+#[allow(clippy::field_reassign_with_default)]
 fn hover_simple(
     sema: &Semantics<'_, RootDatabase>,
     FilePosition { file_id, offset }: FilePosition,
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index c33fbddceff..31bdd2a0e82 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -58,12 +58,14 @@ impl flags::AnalysisStats {
             Rand32::new(seed)
         };
 
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = match self.no_sysroot {
-            true => None,
-            false => Some(RustLibSource::Discover),
+        let cargo_config = CargoConfig {
+            sysroot: match self.no_sysroot {
+                true => None,
+                false => Some(RustLibSource::Discover),
+            },
+            sysroot_query_metadata: self.query_sysroot_metadata,
+            ..Default::default()
         };
-        cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
         let no_progress = &|_| ();
 
         let mut db_load_sw = self.stop_watch();
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs
index 0182cf5402e..6d2e97be20e 100644
--- a/crates/rust-analyzer/src/cli/diagnostics.rs
+++ b/crates/rust-analyzer/src/cli/diagnostics.rs
@@ -13,8 +13,8 @@ use crate::cli::flags;
 
 impl flags::Diagnostics {
     pub fn run(self) -> anyhow::Result<()> {
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = Some(RustLibSource::Discover);
+        let cargo_config =
+            CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
         let with_proc_macro_server = if let Some(p) = &self.proc_macro_srv {
             let path = vfs::AbsPathBuf::assert(std::env::current_dir()?.join(p));
             ProcMacroServerChoice::Explicit(path)
diff --git a/crates/rust-analyzer/src/cli/lsif.rs b/crates/rust-analyzer/src/cli/lsif.rs
index 2138ecead53..64f965e22ac 100644
--- a/crates/rust-analyzer/src/cli/lsif.rs
+++ b/crates/rust-analyzer/src/cli/lsif.rs
@@ -287,8 +287,8 @@ impl flags::Lsif {
     pub fn run(self) -> anyhow::Result<()> {
         eprintln!("Generating LSIF started...");
         let now = Instant::now();
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = Some(RustLibSource::Discover);
+        let cargo_config =
+            CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
         let no_progress = &|_| ();
         let load_cargo_config = LoadCargoConfig {
             load_out_dirs_from_check: true,
diff --git a/crates/rust-analyzer/src/cli/run_tests.rs b/crates/rust-analyzer/src/cli/run_tests.rs
index e1704199151..d07dcdec251 100644
--- a/crates/rust-analyzer/src/cli/run_tests.rs
+++ b/crates/rust-analyzer/src/cli/run_tests.rs
@@ -13,8 +13,8 @@ use crate::cli::{flags, full_name_of_item, Result};
 
 impl flags::RunTests {
     pub fn run(self) -> Result<()> {
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = Some(RustLibSource::Discover);
+        let cargo_config =
+            CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
         let load_cargo_config = LoadCargoConfig {
             load_out_dirs_from_check: true,
             with_proc_macro_server: ProcMacroServerChoice::Sysroot,
diff --git a/crates/rust-analyzer/src/cli/rustc_tests.rs b/crates/rust-analyzer/src/cli/rustc_tests.rs
index 522eb53128f..be7e434acac 100644
--- a/crates/rust-analyzer/src/cli/rustc_tests.rs
+++ b/crates/rust-analyzer/src/cli/rustc_tests.rs
@@ -59,8 +59,8 @@ impl Tester {
         path.push("ra-rustc-test.rs");
         let tmp_file = AbsPathBuf::try_from(path).unwrap();
         std::fs::write(&tmp_file, "")?;
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = Some(RustLibSource::Discover);
+        let cargo_config =
+            CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
         let workspace = ProjectWorkspace::DetachedFiles {
             files: vec![tmp_file.clone()],
             sysroot: Ok(Sysroot::discover(
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index f87dcb889a4..8f11d82f8fd 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -10,8 +10,8 @@ use crate::cli::flags;
 impl flags::Ssr {
     pub fn run(self) -> anyhow::Result<()> {
         use ide_db::base_db::SourceDatabaseExt;
-        let mut cargo_config = CargoConfig::default();
-        cargo_config.sysroot = Some(RustLibSource::Discover);
+        let cargo_config =
+            CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
         let load_cargo_config = LoadCargoConfig {
             load_out_dirs_from_check: true,
             with_proc_macro_server: ProcMacroServerChoice::Sysroot,