more clippy fixes
This commit is contained in:
@@ -27,7 +27,7 @@ pub(crate) struct Logger {
|
||||
|
||||
impl Logger {
|
||||
pub(crate) fn new(file: Option<File>, filter: Option<&str>) -> Logger {
|
||||
let filter = filter.map_or(EnvFilter::default(), |dirs| EnvFilter::new(dirs));
|
||||
let filter = filter.map_or(EnvFilter::default(), EnvFilter::new);
|
||||
|
||||
Logger { filter, file }
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ impl Config {
|
||||
FilesConfig {
|
||||
watcher: match self.data.files_watcher.as_str() {
|
||||
"notify" => FilesWatcher::Notify,
|
||||
"client" | _ => FilesWatcher::Client,
|
||||
_ => FilesWatcher::Client,
|
||||
},
|
||||
exclude: self.data.files_excludeDirs.iter().map(|it| self.root_path.join(it)).collect(),
|
||||
}
|
||||
|
||||
@@ -367,9 +367,8 @@ pub(crate) fn handle_document_symbol(
|
||||
let mut tags = Vec::new();
|
||||
|
||||
#[allow(deprecated)]
|
||||
match symbol.deprecated {
|
||||
Some(true) => tags.push(SymbolTag::Deprecated),
|
||||
_ => {}
|
||||
if let Some(true) = symbol.deprecated {
|
||||
tags.push(SymbolTag::Deprecated)
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
@@ -1094,7 +1093,7 @@ pub(crate) fn handle_code_action_resolve(
|
||||
let _p = profile::span("handle_code_action_resolve");
|
||||
let params = match code_action.data.take() {
|
||||
Some(it) => it,
|
||||
None => return Err(invalid_params_error(format!("code action without data")).into()),
|
||||
None => return Err(invalid_params_error("code action without data".to_string()).into()),
|
||||
};
|
||||
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.code_action_params.text_document.uri)?;
|
||||
@@ -1153,7 +1152,7 @@ pub(crate) fn handle_code_action_resolve(
|
||||
fn parse_action_id(action_id: &str) -> Result<(usize, SingleResolve), String> {
|
||||
let id_parts = action_id.split(':').collect_vec();
|
||||
match id_parts.as_slice() {
|
||||
&[assist_id_string, assist_kind_string, index_string] => {
|
||||
[assist_id_string, assist_kind_string, index_string] => {
|
||||
let assist_kind: AssistKind = assist_kind_string.parse()?;
|
||||
let index: usize = match index_string.parse() {
|
||||
Ok(index) => index,
|
||||
|
||||
@@ -77,7 +77,7 @@ impl GlobalState {
|
||||
return;
|
||||
}
|
||||
let percentage = fraction.map(|f| {
|
||||
assert!(0.0 <= f && f <= 1.0);
|
||||
assert!((0.0..=1.0).contains(&f));
|
||||
(f * 100.0) as u32
|
||||
});
|
||||
let token = lsp_types::ProgressToken::String(format!("rustAnalyzer/{}", title));
|
||||
|
||||
@@ -166,7 +166,7 @@ impl GlobalState {
|
||||
self.handle_event(event)?
|
||||
}
|
||||
|
||||
Err("client exited without proper shutdown sequence")?
|
||||
return Err("client exited without proper shutdown sequence".into());
|
||||
}
|
||||
|
||||
fn next_event(&self, inbox: &Receiver<lsp_server::Message>) -> Option<Event> {
|
||||
@@ -769,7 +769,6 @@ impl GlobalState {
|
||||
if !is_cancelled(&*err) {
|
||||
tracing::error!("failed to compute diagnostics: {:?}", err);
|
||||
}
|
||||
()
|
||||
})
|
||||
.ok()
|
||||
.map(|diags| (file_id, diags))
|
||||
|
||||
@@ -211,7 +211,7 @@ impl GlobalState {
|
||||
|
||||
if same_workspaces {
|
||||
let (workspaces, build_scripts) = self.fetch_build_data_queue.last_op_result();
|
||||
if Arc::ptr_eq(&workspaces, &self.workspaces) {
|
||||
if Arc::ptr_eq(workspaces, &self.workspaces) {
|
||||
let workspaces = workspaces
|
||||
.iter()
|
||||
.cloned()
|
||||
@@ -417,7 +417,7 @@ impl GlobalState {
|
||||
id,
|
||||
Box::new(move |msg| sender.send(msg).unwrap()),
|
||||
config.clone(),
|
||||
root.to_path_buf().into(),
|
||||
root.to_path_buf(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user