@@ -35,7 +35,6 @@ use rustc_hash::{FxHashMap, FxHashSet};
35
35
use semver:: Version ;
36
36
use serde:: { de:: DeserializeOwned , Deserialize , Serialize } ;
37
37
use stdx:: format_to_acc;
38
- use toml;
39
38
use vfs:: { AbsPath , AbsPathBuf } ;
40
39
41
40
use crate :: {
@@ -138,7 +137,7 @@ config_data! {
138
137
/// Unsetting this disables sysroot loading.
139
138
///
140
139
/// 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 ( ) ) ,
142
141
/// Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze
143
142
/// third-party dependencies of the standard libraries.
144
143
///
@@ -171,7 +170,7 @@ config_data! {
171
170
/// Check all targets and tests (`--all-targets`).
172
171
check_allTargets | checkOnSave_allTargets: bool = true ,
173
172
/// 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 ( ) ,
175
174
/// Extra arguments for `cargo check`.
176
175
check_extraArgs | checkOnSave_extraArgs: Vec <String > = vec![ ] ,
177
176
/// Extra environment variables that will be set when running `cargo check`.
@@ -1471,16 +1470,16 @@ impl Config {
1471
1470
}
1472
1471
1473
1472
pub fn extra_args ( & self ) -> & Vec < String > {
1474
- & self . cargo_extraArgs ( )
1473
+ self . cargo_extraArgs ( )
1475
1474
}
1476
1475
1477
1476
pub fn extra_env ( & self ) -> & FxHashMap < String , String > {
1478
- & self . cargo_extraEnv ( )
1477
+ self . cargo_extraEnv ( )
1479
1478
}
1480
1479
1481
1480
pub fn check_extra_args ( & self ) -> Vec < String > {
1482
1481
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 ( ) ) ;
1484
1483
extra_args
1485
1484
}
1486
1485
@@ -1500,11 +1499,11 @@ impl Config {
1500
1499
1501
1500
pub fn proc_macro_srv ( & self ) -> Option < AbsPathBuf > {
1502
1501
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) ) )
1504
1503
}
1505
1504
1506
1505
pub fn ignored_proc_macros ( & self ) -> & FxHashMap < Box < str > , Box < [ Box < str > ] > > {
1507
- & self . procMacro_ignored ( )
1506
+ self . procMacro_ignored ( )
1508
1507
}
1509
1508
1510
1509
pub fn expand_proc_macros ( & self ) -> bool {
@@ -1670,7 +1669,7 @@ impl Config {
1670
1669
. check_noDefaultFeatures ( )
1671
1670
. unwrap_or ( * self . cargo_noDefaultFeatures ( ) ) ,
1672
1671
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( ) ) ,
1674
1673
CargoFeaturesDef :: All
1675
1674
) ,
1676
1675
features : match self
@@ -2023,13 +2022,13 @@ mod single_or_array {
2023
2022
deserializer. deserialize_any ( SingleOrVec )
2024
2023
}
2025
2024
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 >
2027
2026
where
2028
2027
S : serde:: Serializer ,
2029
2028
{
2030
- match & vec[ .. ] {
2029
+ match vec {
2031
2030
// [] case is handled by skip_serializing_if
2032
- [ single] => serializer. serialize_str ( & single) ,
2031
+ [ single] => serializer. serialize_str ( single) ,
2033
2032
slice => slice. serialize ( serializer) ,
2034
2033
}
2035
2034
}
@@ -2248,7 +2247,7 @@ macro_rules! _default_val {
2248
2247
2249
2248
macro_rules! _default_str {
2250
2249
( @verbatim: $s: literal, $_ty: ty) => {
2251
- $s. to_string ( )
2250
+ $s. to_owned ( )
2252
2251
} ;
2253
2252
( $default: expr, $ty: ty) => { {
2254
2253
let val = default_val!( $default, $ty) ;
0 commit comments