Skip to content

Commit bc4e4b1

Browse files
committed
fix some clippy errors.
1 parent 8cc1bee commit bc4e4b1

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
@@ -35,7 +35,6 @@ use rustc_hash::{FxHashMap, FxHashSet};
3535
use semver::Version;
3636
use serde::{de::DeserializeOwned, Deserialize, Serialize};
3737
use stdx::format_to_acc;
38-
use toml;
3938
use vfs::{AbsPath, AbsPathBuf};
4039

4140
use crate::{
@@ -138,7 +137,7 @@ config_data! {
138137
/// Unsetting this disables sysroot loading.
139138
///
140139
/// This option does not take effect until rust-analyzer is restarted.
141-
cargo_sysroot: Option<String> = Some("discover".to_string()),
140+
cargo_sysroot: Option<String> = Some("discover".to_owned()),
142141
/// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
143142
/// third-party dependencies of the standard libraries.
144143
///
@@ -171,7 +170,7 @@ config_data! {
171170
/// Check all targets and tests (`--all-targets`).
172171
check_allTargets | checkOnSave_allTargets: bool = true,
173172
/// Cargo command to use for `cargo check`.
174-
check_command | checkOnSave_command: String = "check".to_string(),
173+
check_command | checkOnSave_command: String = "check".to_owned(),
175174
/// Extra arguments for `cargo check`.
176175
check_extraArgs | checkOnSave_extraArgs: Vec<String> = vec![],
177176
/// Extra environment variables that will be set when running `cargo check`.
@@ -1471,16 +1470,16 @@ impl Config {
14711470
}
14721471

14731472
pub fn extra_args(&self) -> &Vec<String> {
1474-
&self.cargo_extraArgs()
1473+
self.cargo_extraArgs()
14751474
}
14761475

14771476
pub fn extra_env(&self) -> &FxHashMap<String, String> {
1478-
&self.cargo_extraEnv()
1477+
self.cargo_extraEnv()
14791478
}
14801479

14811480
pub fn check_extra_args(&self) -> Vec<String> {
14821481
let mut extra_args = self.extra_args().clone();
1483-
extra_args.extend_from_slice(&self.check_extraArgs());
1482+
extra_args.extend_from_slice(self.check_extraArgs());
14841483
extra_args
14851484
}
14861485

@@ -1500,11 +1499,11 @@ impl Config {
15001499

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

15061505
pub fn ignored_proc_macros(&self) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
1507-
&self.procMacro_ignored()
1506+
self.procMacro_ignored()
15081507
}
15091508

15101509
pub fn expand_proc_macros(&self) -> bool {
@@ -1670,7 +1669,7 @@ impl Config {
16701669
.check_noDefaultFeatures()
16711670
.unwrap_or(*self.cargo_noDefaultFeatures()),
16721671
all_features: matches!(
1673-
self.check_features().as_ref().unwrap_or(&self.cargo_features()),
1672+
self.check_features().as_ref().unwrap_or(self.cargo_features()),
16741673
CargoFeaturesDef::All
16751674
),
16761675
features: match self
@@ -2023,13 +2022,13 @@ mod single_or_array {
20232022
deserializer.deserialize_any(SingleOrVec)
20242023
}
20252024

2026-
pub(super) fn serialize<S>(vec: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
2025+
pub(super) fn serialize<S>(vec: &[String], serializer: S) -> Result<S::Ok, S::Error>
20272026
where
20282027
S: serde::Serializer,
20292028
{
2030-
match &vec[..] {
2029+
match vec {
20312030
// [] case is handled by skip_serializing_if
2032-
[single] => serializer.serialize_str(&single),
2031+
[single] => serializer.serialize_str(single),
20332032
slice => slice.serialize(serializer),
20342033
}
20352034
}
@@ -2248,7 +2247,7 @@ macro_rules! _default_val {
22482247

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

0 commit comments

Comments
 (0)