Skip to content

Commit 94eab88

Browse files
committed
fix some clippy errors.
1 parent 08cf854 commit 94eab88

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 11 additions & 12 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::{
@@ -137,7 +136,7 @@ config_data! {
137136
/// Unsetting this disables sysroot loading.
138137
///
139138
/// This option does not take effect until rust-analyzer is restarted.
140-
cargo_sysroot: Option<String> = Some("discover".to_string()),
139+
cargo_sysroot: Option<String> = Some("discover".to_owned()),
141140
/// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
142141
/// third-party dependencies of the standard libraries.
143142
///
@@ -171,7 +170,7 @@ config_data! {
171170
/// `#rust-analyzer.cargo.allTargets#`.
172171
check_allTargets | checkOnSave_allTargets: Option<bool> = Option::<bool>::None,
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`.
@@ -1485,16 +1484,16 @@ impl Config {
14851484
}
14861485

14871486
pub fn extra_args(&self) -> &Vec<String> {
1488-
&self.cargo_extraArgs()
1487+
self.cargo_extraArgs()
14891488
}
14901489

14911490
pub fn extra_env(&self) -> &FxHashMap<String, String> {
1492-
&self.cargo_extraEnv()
1491+
self.cargo_extraEnv()
14931492
}
14941493

14951494
pub fn check_extra_args(&self) -> Vec<String> {
14961495
let mut extra_args = self.extra_args().clone();
1497-
extra_args.extend_from_slice(&self.check_extraArgs());
1496+
extra_args.extend_from_slice(self.check_extraArgs());
14981497
extra_args
14991498
}
15001499

@@ -1514,11 +1513,11 @@ impl Config {
15141513

15151514
pub fn proc_macro_srv(&self) -> Option<AbsPathBuf> {
15161515
let path = self.procMacro_server().clone()?;
1517-
Some(AbsPathBuf::try_from(path).unwrap_or_else(|path| self.root_path.join(&path)))
1516+
Some(AbsPathBuf::try_from(path).unwrap_or_else(|path| self.root_path.join(path)))
15181517
}
15191518

15201519
pub fn ignored_proc_macros(&self) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
1521-
&self.procMacro_ignored()
1520+
self.procMacro_ignored()
15221521
}
15231522

15241523
pub fn expand_proc_macros(&self) -> bool {
@@ -2061,13 +2060,13 @@ mod single_or_array {
20612060
deserializer.deserialize_any(SingleOrVec)
20622061
}
20632062

2064-
pub(super) fn serialize<S>(vec: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
2063+
pub(super) fn serialize<S>(vec: &[String], serializer: S) -> Result<S::Ok, S::Error>
20652064
where
20662065
S: serde::Serializer,
20672066
{
2068-
match &vec[..] {
2067+
match vec {
20692068
// [] case is handled by skip_serializing_if
2070-
[single] => serializer.serialize_str(&single),
2069+
[single] => serializer.serialize_str(single),
20712070
slice => slice.serialize(serializer),
20722071
}
20732072
}
@@ -2286,7 +2285,7 @@ macro_rules! _default_val {
22862285

22872286
macro_rules! _default_str {
22882287
(@verbatim: $s:literal, $_ty:ty) => {
2289-
$s.to_string()
2288+
$s.to_owned()
22902289
};
22912290
($default:expr, $ty:ty) => {{
22922291
let val = default_val!($default, $ty);

0 commit comments

Comments
 (0)