Skip to content

Commit

Permalink
fix some clippy errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
alibektas committed Feb 24, 2024
1 parent 053f1d6 commit f94ef73
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ config_data! {
/// Unsetting this disables sysroot loading.
///
/// This option does not take effect until rust-analyzer is restarted.
cargo_sysroot: Option<String> = Some("discover".to_string()),
cargo_sysroot: Option<String> = Some("discover".to_owned()),
/// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
/// third-party dependencies of the standard libraries.
///
Expand All @@ -163,7 +163,7 @@ config_data! {
/// Check all targets and tests (`--all-targets`).
check_allTargets | checkOnSave_allTargets: bool = true,
/// Cargo command to use for `cargo check`.
check_command | checkOnSave_command: String = "check".to_string(),
check_command | checkOnSave_command: String = "check".to_owned(),
/// Extra arguments for `cargo check`.
check_extraArgs | checkOnSave_extraArgs: Vec<String> = vec![],
/// Extra environment variables that will be set when running `cargo check`.
Expand Down Expand Up @@ -1461,16 +1461,16 @@ impl Config {
}

pub fn extra_args(&self) -> &Vec<String> {
&self.cargo_extraArgs()
self.cargo_extraArgs()
}

pub fn extra_env(&self) -> &FxHashMap<String, String> {
&self.cargo_extraEnv()
self.cargo_extraEnv()
}

pub fn check_extra_args(&self) -> Vec<String> {
let mut extra_args = self.extra_args().clone();
extra_args.extend_from_slice(&self.check_extraArgs());
extra_args.extend_from_slice(self.check_extraArgs());
extra_args
}

Expand All @@ -1490,11 +1490,11 @@ impl Config {

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

pub fn ignored_proc_macros(&self) -> &FxHashMap<Box<str>, Box<[Box<str>]>> {
&self.procMacro_ignored()
self.procMacro_ignored()
}

pub fn expand_proc_macros(&self) -> bool {
Expand Down Expand Up @@ -1660,7 +1660,7 @@ impl Config {
.check_noDefaultFeatures()
.unwrap_or(*self.cargo_noDefaultFeatures()),
all_features: matches!(
self.check_features().as_ref().unwrap_or(&self.cargo_features()),
self.check_features().as_ref().unwrap_or(self.cargo_features()),
CargoFeaturesDef::All
),
features: match self
Expand Down Expand Up @@ -2015,13 +2015,13 @@ mod single_or_array {
deserializer.deserialize_any(SingleOrVec)
}

pub(crate) fn serialize<S>(vec: &Vec<String>, serializer: S) -> Result<S::Ok, S::Error>
pub(crate) fn serialize<S>(vec: &[String], serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match &vec[..] {
match vec {
// [] case is handled by skip_serializing_if
[single] => serializer.serialize_str(&single),
[single] => serializer.serialize_str(single),
slice => slice.serialize(serializer),
}
}
Expand Down Expand Up @@ -2240,7 +2240,7 @@ macro_rules! _default_val {

macro_rules! _default_str {
(@verbatim: $s:literal, $_ty:ty) => {
$s.to_string()
$s.to_owned()
};
($default:expr, $ty:ty) => {{
let val = default_val!($default, $ty);
Expand Down

0 comments on commit f94ef73

Please sign in to comment.