Skip to content

Commit

Permalink
Fix nightly Rust/Clippy lints
Browse files Browse the repository at this point in the history
In particular, this takes care of rust-lang/rust#79202
as well as some clippy nightly suggestions.

There is a new very noisy https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
but I didn’t take care of that one.
  • Loading branch information
Swatinem committed Mar 14, 2021
1 parent cbe9fb6 commit 1dc2069
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion crates/rslint_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl Default for ConfigRepr {
}
}

#[serde(default)]
#[derive(Debug, Deserialize, Serialize, Default)]
#[serde(default)]
struct RulesConfigRepr {
#[serde(deserialize_with = "de::from_rule_objects")]
errors: RuleList,
Expand Down
2 changes: 1 addition & 1 deletion crates/rslint_core/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ macro_rules! __declare_lint_inner {
use serde::{Deserialize, Serialize};

#[doc = $doc]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
$(#[$outer])*
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct $name {
$(
$(
Expand Down
14 changes: 5 additions & 9 deletions crates/rslint_errors/src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,11 @@ pub fn convert_to_lsp_diagnostic(
message.push_str(&footer.msg);
}

let tags = if let Some(tag) = diagnostic.tag {
Some(match tag {
DiagnosticTag::Deprecated => vec![LspTag::Deprecated],
DiagnosticTag::Unnecessary => vec![LspTag::Unnecessary],
DiagnosticTag::Both => vec![LspTag::Deprecated, LspTag::Unnecessary],
})
} else {
None
};
let tags = diagnostic.tag.map(|tag| match tag {
DiagnosticTag::Deprecated => vec![LspTag::Deprecated],
DiagnosticTag::Unnecessary => vec![LspTag::Unnecessary],
DiagnosticTag::Both => vec![LspTag::Deprecated, LspTag::Unnecessary],
});

Some(lsp_types::Diagnostic {
range: primary_label?,
Expand Down
2 changes: 1 addition & 1 deletion crates/rslint_lsp/src/core/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use taplo::{parser::Parse, util::coords::Mapper};
use tower_lsp::lsp_types::ConfigurationItem;
use tower_lsp::{lsp_types::*, Client};

#[serde(rename_all = "camelCase")]
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Config {
pub incorrect_file_autofixes: bool,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rslint_lsp/src/provider/toml_completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub(crate) fn toml_completions(
None => None,
}),
})
.filter_map(|s| s)
.flatten()
.map(|schema| {
value_completions(
&root_schema.definitions,
Expand Down Expand Up @@ -626,7 +626,7 @@ fn value_completions(
}
})
})
.filter_map(|c| c)
.flatten()
.collect();
}

Expand Down
2 changes: 1 addition & 1 deletion xtask/src/coverage/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub fn get_test_files(query: Option<&str>, pool: &Pool) -> Vec<TestFile> {
let code = read_to_string(entry.path()).ok()?;
let meta = read_metadata(&code).ok()?;
let path = entry.into_path();
Some(TestFile { code, meta, path }).filter(|file| file.meta.features.is_empty())
Some(TestFile { meta, code, path }).filter(|file| file.meta.features.is_empty())
}

if let Some(file) = parse_file(file) {
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/docgen/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,6 @@ impl Parse for Example {
let docstring = parse_docstring(&input);
let string = input.parse::<LitStr>()?.value();
let source = unindent(&string).trim().to_string();
Ok(Example { docstring, source })
Ok(Example { source, docstring })
}
}

0 comments on commit 1dc2069

Please sign in to comment.