Skip to content

Commit 1fb04f1

Browse files
committed
fix some clippy errors.
1 parent 899b5b7 commit 1fb04f1

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use rustc_hash::{FxHashMap, FxHashSet};
3232
use semver::Version;
3333
use serde::{de::DeserializeOwned, Deserialize, Serialize};
3434
use stdx::format_to_acc;
35-
use toml;
3635
use vfs::{AbsPath, AbsPathBuf};
3736

3837
use crate::{
@@ -135,7 +134,7 @@ config_data! {
135134
/// Unsetting this disables sysroot loading.
136135
///
137136
/// This option does not take effect until rust-analyzer is restarted.
138-
cargo_sysroot: Option<String> = Some("discover".to_string()),
137+
cargo_sysroot: Option<String> = Some("discover".to_owned()),
139138
/// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
140139
/// third-party dependencies of the standard libraries.
141140
///
@@ -168,7 +167,7 @@ config_data! {
168167
/// Check all targets and tests (`--all-targets`).
169168
check_allTargets | checkOnSave_allTargets: bool = true,
170169
/// Cargo command to use for `cargo check`.
171-
check_command | checkOnSave_command: String = "check".to_string(),
170+
check_command | checkOnSave_command: String = "check".to_owned(),
172171
/// Extra arguments for `cargo check`.
173172
check_extraArgs | checkOnSave_extraArgs: Vec<String> = vec![],
174173
/// Extra environment variables that will be set when running `cargo check`.
@@ -1468,16 +1467,16 @@ impl Config {
14681467
}
14691468

14701469
pub fn extra_args(&self) -> &Vec<String> {
1471-
&self.cargo_extraArgs()
1470+
self.cargo_extraArgs()
14721471
}
14731472

14741473
pub fn extra_env(&self) -> &FxHashMap<String, String> {
1475-
&self.cargo_extraEnv()
1474+
self.cargo_extraEnv()
14761475
}
14771476

14781477
pub fn check_extra_args(&self) -> Vec<String> {
14791478
let mut extra_args = self.extra_args().clone();
1480-
extra_args.extend_from_slice(&self.check_extraArgs());
1479+
extra_args.extend_from_slice(self.check_extraArgs());
14811480
extra_args
14821481
}
14831482

@@ -1497,11 +1496,11 @@ impl Config {
14971496

14981497
pub fn proc_macro_srv(&self) -> Option<AbsPathBuf> {
14991498
let path = self.procMacro_server().clone()?;
1500-
Some(AbsPathBuf::try_from(path).unwrap_or_else(|path| self.root_path.join(&path)))
1499+
Some(AbsPathBuf::try_from(path).unwrap_or_else(|path| self.root_path.join(path)))
15011500
}
15021501

15031502
pub fn ignored_proc_macros(&self) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
1504-
&self.procMacro_ignored()
1503+
self.procMacro_ignored()
15051504
}
15061505

15071506
pub fn expand_proc_macros(&self) -> bool {
@@ -1667,7 +1666,7 @@ impl Config {
16671666
.check_noDefaultFeatures()
16681667
.unwrap_or(*self.cargo_noDefaultFeatures()),
16691668
all_features: matches!(
1670-
self.check_features().as_ref().unwrap_or(&self.cargo_features()),
1669+
self.check_features().as_ref().unwrap_or(self.cargo_features()),
16711670
CargoFeaturesDef::All
16721671
),
16731672
features: match self
@@ -2022,13 +2021,13 @@ mod single_or_array {
20222021
deserializer.deserialize_any(SingleOrVec)
20232022
}
20242023

2025-
pub(super) fn serialize<S>(vec: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
2024+
pub(super) fn serialize<S>(vec: &[String], serializer: S) -> Result<S::Ok, S::Error>
20262025
where
20272026
S: serde::Serializer,
20282027
{
2029-
match &vec[..] {
2028+
match vec {
20302029
// [] case is handled by skip_serializing_if
2031-
[single] => serializer.serialize_str(&single),
2030+
[single] => serializer.serialize_str(single),
20322031
slice => slice.serialize(serializer),
20332032
}
20342033
}
@@ -2247,7 +2246,7 @@ macro_rules! _default_val {
22472246

22482247
macro_rules! _default_str {
22492248
(@verbatim: $s:literal, $_ty:ty) => {
2250-
$s.to_string()
2249+
$s.to_owned()
22512250
};
22522251
($default:expr, $ty:ty) => {{
22532252
let val = default_val!($default, $ty);

0 commit comments

Comments
 (0)