Skip to content

Commit

Permalink
refactor: convert clippy allows to clippy expects (#4791)
Browse files Browse the repository at this point in the history
Co-authored-by: 12ball <[email protected]>
Co-authored-by: Carson McManus <[email protected]>
  • Loading branch information
3 people authored Dec 29, 2024
1 parent 3c32a66 commit 2021948
Show file tree
Hide file tree
Showing 162 changed files with 638 additions and 2,627 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ unused_lifetimes = "warn"
unused_macro_rules = "warn"

[workspace.lints.clippy]
allow_attributes = "deny"
cargo_common_metadata = "allow"
empty_docs = "allow" # there are some false positives inside biome_wasm
multiple_crate_versions = "allow"
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'a, R> RuleContext<'a, R>
where
R: Rule + Sized + 'static,
{
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub fn new(
query_result: &'a RuleQueryResult<R>,
root: &'a RuleRoot<R>,
Expand Down
12 changes: 6 additions & 6 deletions crates/biome_analyze/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ macro_rules! declare_lint_rule {
// This is implemented by calling the `group_category!` macro from the
// parent module (that should be declared by a call to `declare_group!`)
// and providing it with the name of this rule as a string literal token
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! rule_category {
() => { super::group_category!( $name ) };
}
Expand Down Expand Up @@ -497,7 +497,7 @@ macro_rules! declare_syntax_rule {
// This is implemented by calling the `group_category!` macro from the
// parent module (that should be declared by a call to `declare_group!`)
// and providing it with the name of this rule as a string literal token
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! rule_category {
() => { super::group_category!( $name ) };
}
Expand Down Expand Up @@ -564,7 +564,7 @@ macro_rules! declare_source_rule {
);

/// This macro returns the corresponding [ActionCategory] to use inside the [RuleAction]
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! rule_action_category {
() => { ActionCategory::Source(SourceActionKind::Other(Cow::Borrowed(concat!($language, ".", $name) ))) };
}
Expand Down Expand Up @@ -609,7 +609,7 @@ macro_rules! declare_lint_group {
// name within this group.
// This is implemented by calling the `category_concat!` macro with the
// "lint" prefix, the name of this group, and the rule name argument
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! group_category {
( $rule_name:tt ) => { $crate::category_concat!( "lint", $name, $rule_name ) };
}
Expand Down Expand Up @@ -646,7 +646,7 @@ macro_rules! declare_assists_group {
// name within this group.
// This is implemented by calling the `category_concat!` macro with the
// "lint" prefix, the name of this group, and the rule name argument
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! group_category {
( $rule_name:tt ) => { $crate::category_concat!( "assists", $name, $rule_name ) };
}
Expand Down Expand Up @@ -683,7 +683,7 @@ macro_rules! declare_syntax_group {
// name within this group.
// This is implemented by calling the `category_concat!` macro with the
// "lint" prefix, the name of this group, and the rule name argument
#[allow(unused_macros)]
#[expect(unused_macros)]
macro_rules! group_category {
( $rule_name:tt ) => { $crate::category_concat!( "syntax", $name, $rule_name ) };
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl MissingServicesDiagnostic {
}

pub trait FromServices: Sized {
#[allow(clippy::result_large_err)]
#[expect(clippy::result_large_err)]
fn from_services(
rule_key: &RuleKey,
services: &ServiceBag,
Expand Down
1 change: 0 additions & 1 deletion crates/biome_aria_metadata/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ enum AriaAttributeType {

#[derive(Debug, Default, biome_deserialize_macros::Merge, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
struct ValueDefinition {
description: String,
is_default: bool,
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_cli/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ struct JsonRpcRequest<P> {
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
struct JsonRpcResponse {
#[allow(dead_code)]
#[expect(dead_code)]
jsonrpc: Cow<'static, str>,
id: u64,
result: Option<Box<RawValue>>,
Expand All @@ -431,10 +431,10 @@ struct JsonRpcResponse {

#[derive(Debug, Deserialize)]
struct JsonRpcError {
#[allow(dead_code)]
#[expect(dead_code)]
code: i64,
message: String,
#[allow(dead_code)]
#[expect(dead_code)]
data: Option<Box<RawValue>>,
}

Expand Down
4 changes: 0 additions & 4 deletions crates/biome_cli/tests/commands/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,10 @@ const APPLY_ATTRIBUTE_POSITION_AFTER: &str = r#"<Foo
</Foo>;
"#;

// Without this, Test (windows-latest) fails with: `warning: constant `DEFAULT_CONFIGURATION_BEFORE` is never used`
#[allow(dead_code)]
const DEFAULT_CONFIGURATION_BEFORE: &str = r#"function f() {
return { a, b }
}"#;

// Without this, Test (windows-latest) fails with: `warning: constant `DEFAULT_CONFIGURATION_AFTER` is never used`
#[allow(dead_code)]
const DEFAULT_CONFIGURATION_AFTER: &str = "function f() {
return { a, b };
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_configuration/src/editorconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub enum EditorconfigValue<T> {
}

// This is an `Into` because implementing `From` is not possible because you can't implement traits for a type you don't own.
#[allow(clippy::from_over_into)]
#[expect(clippy::from_over_into)]
impl<T: Default> Into<Option<T>> for EditorconfigValue<T> {
fn into(self) -> Option<T> {
match self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Visitor for NoDeclarationBlockShorthandPropertyOverridesVisitor {
.and_then(|property_node| property_node.name().ok())
{
let prop = prop_node.text();
#[allow(clippy::disallowed_methods)]
#[expect(clippy::disallowed_methods)]
let prop_lowercase = prop.to_lowercase();

let prop_prefix = vender_prefix(&prop_lowercase);
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_analyze/tests/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn run_test(input: &'static str, _: &str, _: &str, _: &str) {
}
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
pub(crate) fn analyze_and_snap(
snapshot: &mut String,
input_code: &str,
Expand Down
1 change: 0 additions & 1 deletion crates/biome_css_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/biome_css_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/css/bogus/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.
#[allow(clippy::module_inception)]
#[expect(clippy::module_inception)]
pub(crate) mod bogus;
pub(crate) mod bogus_at_rule;
pub(crate) mod bogus_block;
Expand Down
Loading

0 comments on commit 2021948

Please sign in to comment.