Skip to content

Commit 04ccef8

Browse files
committed
field_reassign_with_default
1 parent dd9f27b commit 04ccef8

File tree

8 files changed

+18
-16
lines changed

8 files changed

+18
-16
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ new_ret_no_self = "allow"
168168
## Following lints should be tackled at some point
169169
borrowed_box = "allow"
170170
derived_hash_with_manual_eq = "allow"
171-
field_reassign_with_default = "allow"
172171
forget_non_drop = "allow"
173172
format_collect = "allow"
174173
large_enum_variant = "allow"

crates/ide/src/hover.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ pub(crate) fn hover(
120120
Some(res)
121121
}
122122

123+
#[allow(clippy::field_reassign_with_default)]
123124
fn hover_simple(
124125
sema: &Semantics<'_, RootDatabase>,
125126
FilePosition { file_id, offset }: FilePosition,

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ impl flags::AnalysisStats {
5858
Rand32::new(seed)
5959
};
6060

61-
let mut cargo_config = CargoConfig::default();
62-
cargo_config.sysroot = match self.no_sysroot {
63-
true => None,
64-
false => Some(RustLibSource::Discover),
61+
let cargo_config = CargoConfig {
62+
sysroot: match self.no_sysroot {
63+
true => None,
64+
false => Some(RustLibSource::Discover),
65+
},
66+
sysroot_query_metadata: self.query_sysroot_metadata,
67+
..Default::default()
6568
};
66-
cargo_config.sysroot_query_metadata = self.query_sysroot_metadata;
6769
let no_progress = &|_| ();
6870

6971
let mut db_load_sw = self.stop_watch();

crates/rust-analyzer/src/cli/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use crate::cli::flags;
1313

1414
impl flags::Diagnostics {
1515
pub fn run(self) -> anyhow::Result<()> {
16-
let mut cargo_config = CargoConfig::default();
17-
cargo_config.sysroot = Some(RustLibSource::Discover);
16+
let cargo_config =
17+
CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
1818
let with_proc_macro_server = if let Some(p) = &self.proc_macro_srv {
1919
let path = vfs::AbsPathBuf::assert(std::env::current_dir()?.join(p));
2020
ProcMacroServerChoice::Explicit(path)

crates/rust-analyzer/src/cli/lsif.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ impl flags::Lsif {
287287
pub fn run(self) -> anyhow::Result<()> {
288288
eprintln!("Generating LSIF started...");
289289
let now = Instant::now();
290-
let mut cargo_config = CargoConfig::default();
291-
cargo_config.sysroot = Some(RustLibSource::Discover);
290+
let cargo_config =
291+
CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
292292
let no_progress = &|_| ();
293293
let load_cargo_config = LoadCargoConfig {
294294
load_out_dirs_from_check: true,

crates/rust-analyzer/src/cli/run_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use crate::cli::{flags, full_name_of_item, Result};
1313

1414
impl flags::RunTests {
1515
pub fn run(self) -> Result<()> {
16-
let mut cargo_config = CargoConfig::default();
17-
cargo_config.sysroot = Some(RustLibSource::Discover);
16+
let cargo_config =
17+
CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
1818
let load_cargo_config = LoadCargoConfig {
1919
load_out_dirs_from_check: true,
2020
with_proc_macro_server: ProcMacroServerChoice::Sysroot,

crates/rust-analyzer/src/cli/rustc_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ impl Tester {
5959
path.push("ra-rustc-test.rs");
6060
let tmp_file = AbsPathBuf::try_from(path).unwrap();
6161
std::fs::write(&tmp_file, "")?;
62-
let mut cargo_config = CargoConfig::default();
63-
cargo_config.sysroot = Some(RustLibSource::Discover);
62+
let cargo_config =
63+
CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
6464
let workspace = ProjectWorkspace::DetachedFiles {
6565
files: vec![tmp_file.clone()],
6666
sysroot: Ok(Sysroot::discover(

crates/rust-analyzer/src/cli/ssr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use crate::cli::flags;
1010
impl flags::Ssr {
1111
pub fn run(self) -> anyhow::Result<()> {
1212
use ide_db::base_db::SourceDatabaseExt;
13-
let mut cargo_config = CargoConfig::default();
14-
cargo_config.sysroot = Some(RustLibSource::Discover);
13+
let cargo_config =
14+
CargoConfig { sysroot: Some(RustLibSource::Discover), ..Default::default() };
1515
let load_cargo_config = LoadCargoConfig {
1616
load_out_dirs_from_check: true,
1717
with_proc_macro_server: ProcMacroServerChoice::Sysroot,

0 commit comments

Comments
 (0)