From 94ccc0af3ec60e612eb698d5f0371962175444f7 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 17 Aug 2024 15:32:45 +0800 Subject: [PATCH] chore: bump derive_more to v1.0 --- Cargo.lock | 43 ++++++++----------- Cargo.toml | 2 +- src/rules/adjacent_overload_signatures.rs | 12 +++--- src/rules/default_param_last.rs | 6 +-- src/rules/eqeqeq.rs | 8 ++-- src/rules/explicit_function_return_type.rs | 4 +- src/rules/explicit_module_boundary_types.rs | 8 ++-- src/rules/getter_return.rs | 6 +-- src/rules/no_compare_neg_zero.rs | 4 +- src/rules/no_cond_assign.rs | 6 +-- src/rules/no_const_assign.rs | 4 +- src/rules/no_constant_condition.rs | 6 +-- src/rules/no_control_regex.rs | 4 +- src/rules/no_debugger.rs | 4 +- src/rules/no_delete_var.rs | 4 +- src/rules/no_dupe_args.rs | 4 +- src/rules/no_dupe_class_members.rs | 4 +- src/rules/no_dupe_else_if.rs | 6 +-- src/rules/no_dupe_keys.rs | 4 +- src/rules/no_duplicate_case.rs | 4 +- src/rules/no_empty_interface.rs | 4 +- src/rules/no_ex_assign.rs | 4 +- src/rules/no_external_imports.rs | 4 +- src/rules/no_extra_boolean_cast.rs | 8 ++-- src/rules/no_extra_non_null_assertion.rs | 4 +- src/rules/no_fallthrough.rs | 4 +- src/rules/no_func_assign.rs | 6 +-- src/rules/no_global_assign.rs | 4 +- src/rules/no_inferrable_types.rs | 4 +- src/rules/no_inner_declarations.rs | 4 +- src/rules/no_irregular_whitespace.rs | 2 +- src/rules/no_misused_new.rs | 12 +++--- .../no_non_null_asserted_optional_chain.rs | 2 +- src/rules/no_non_null_assertion.rs | 2 +- src/rules/no_self_assign.rs | 6 +-- src/rules/no_self_compare.rs | 2 +- src/rules/no_shadow_restricted_names.rs | 2 +- src/rules/no_sparse_arrays.rs | 2 +- src/rules/no_throw_literal.rs | 4 +- src/rules/no_unsafe_finally.rs | 8 ++-- src/rules/no_unsafe_negation.rs | 2 +- src/rules/no_unused_labels.rs | 2 +- src/rules/no_unused_vars.rs | 6 +-- src/rules/prefer_as_const.rs | 4 +- src/rules/prefer_const.rs | 4 +- src/rules/prefer_primordials.rs | 28 ++++++------ src/rules/require_await.rs | 12 +++--- src/rules/single_var_declarator.rs | 2 +- src/rules/triple_slash_reference.rs | 2 +- src/rules/use_isnan.rs | 8 ++-- src/rules/verbatim_module_syntax.rs | 14 +++--- 51 files changed, 146 insertions(+), 169 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 175fe6c1e..74e920614 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,12 +192,6 @@ dependencies = [ "vte", ] -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "cpufeatures" version = "0.2.12" @@ -343,15 +337,23 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.18" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn 2.0.72", + "unicode-xid", ] [[package]] @@ -924,15 +926,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.18" @@ -966,12 +959,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - [[package]] name = "serde" version = "1.0.204" @@ -1545,6 +1532,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "url" version = "2.5.2" diff --git a/Cargo.toml b/Cargo.toml index 787b86e71..51932a8f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ serde = { version = "1.0.195", features = ["derive"] } serde_json = "1.0.111" regex = "1.10.2" once_cell = "1.19.0" -derive_more = { version = "0.99.17", features = ["display"] } +derive_more = { version = "1.0", features = ["display"] } anyhow = "1.0.79" if_chain = "1.0.2" phf = { version = "0.11.2", features = ["macros"] } diff --git a/src/rules/adjacent_overload_signatures.rs b/src/rules/adjacent_overload_signatures.rs index 7ea7cdd20..07d43143e 100644 --- a/src/rules/adjacent_overload_signatures.rs +++ b/src/rules/adjacent_overload_signatures.rs @@ -15,13 +15,13 @@ const CODE: &str = "adjacent-overload-signatures"; #[derive(Display)] enum AdjacentOverloadSignaturesMessage { - #[display(fmt = "All `{}` signatures should be adjacent", _0)] + #[display("All `{}` signatures should be adjacent", _0)] ShouldBeAdjacent(String), } #[derive(Display)] enum AdjacentOverloadSignaturesHint { - #[display(fmt = "Make sure all overloaded signatures are grouped together")] + #[display("Make sure all overloaded signatures are grouped together")] GroupedTogether, } @@ -204,13 +204,13 @@ impl<'a> ExtractMethod for ast_view::TsTypeElement<'a> { #[derive(PartialEq, Eq, Hash, Clone, Display)] #[allow(clippy::enum_variant_names)] enum Method { - #[display(fmt = "{}", _0)] + #[display("{}", _0)] Method(String), - #[display(fmt = "{}", _0)] + #[display("{}", _0)] Static(String), - #[display(fmt = "call")] + #[display("call")] CallSignature, - #[display(fmt = "new")] + #[display("new")] ConstructSignature, } diff --git a/src/rules/default_param_last.rs b/src/rules/default_param_last.rs index 49922e5bb..a2c697671 100644 --- a/src/rules/default_param_last.rs +++ b/src/rules/default_param_last.rs @@ -13,15 +13,13 @@ const CODE: &str = "default-param-last"; #[derive(Display)] enum DefaultParamLastMessage { - #[display(fmt = "default parameters should be at last")] + #[display("default parameters should be at last")] DefaultLast, } #[derive(Display)] enum DefaultParamLastHint { - #[display( - fmt = "Modify the signatures to move default parameter(s) to the end" - )] + #[display("Modify the signatures to move default parameter(s) to the end")] MoveToEnd, } diff --git a/src/rules/eqeqeq.rs b/src/rules/eqeqeq.rs index 128b37082..56648396a 100644 --- a/src/rules/eqeqeq.rs +++ b/src/rules/eqeqeq.rs @@ -14,17 +14,17 @@ const CODE: &str = "eqeqeq"; #[derive(Display)] enum EqeqeqMessage { - #[display(fmt = "expected '===' and instead saw '=='.")] + #[display("expected '===' and instead saw '=='.")] ExpectedEqual, - #[display(fmt = "expected '!==' and instead saw '!='.")] + #[display("expected '!==' and instead saw '!='.")] ExpectedNotEqual, } #[derive(Display)] enum EqeqeqHint { - #[display(fmt = "Use '==='")] + #[display("Use '==='")] UseEqeqeq, - #[display(fmt = "Use '!=='")] + #[display("Use '!=='")] UseNoteqeq, } diff --git a/src/rules/explicit_function_return_type.rs b/src/rules/explicit_function_return_type.rs index 6003b3734..fa111936c 100644 --- a/src/rules/explicit_function_return_type.rs +++ b/src/rules/explicit_function_return_type.rs @@ -13,13 +13,13 @@ const CODE: &str = "explicit-function-return-type"; #[derive(Display)] enum ExplicitFunctionReturnTypeMessage { - #[display(fmt = "Missing return type on function")] + #[display("Missing return type on function")] MissingRetType, } #[derive(Display)] enum ExplicitFunctionReturnTypeHint { - #[display(fmt = "Add a return type to the function signature")] + #[display("Add a return type to the function signature")] AddRetType, } diff --git a/src/rules/explicit_module_boundary_types.rs b/src/rules/explicit_module_boundary_types.rs index f153d98dc..b489b6f46 100644 --- a/src/rules/explicit_module_boundary_types.rs +++ b/src/rules/explicit_module_boundary_types.rs @@ -13,19 +13,19 @@ const CODE: &str = "explicit-module-boundary-types"; #[derive(Display)] enum ExplicitModuleBoundaryTypesMessage { - #[display(fmt = "Missing return type on function")] + #[display("Missing return type on function")] MissingRetType, - #[display(fmt = "All arguments should be typed")] + #[display("All arguments should be typed")] MissingArgType, } #[derive(Display)] enum ExplicitModuleBoundaryTypesHint { - #[display(fmt = "Add a return type to the function signature")] + #[display("Add a return type to the function signature")] AddRetType, - #[display(fmt = "Add types to all the function arguments")] + #[display("Add types to all the function arguments")] AddArgTypes, } diff --git a/src/rules/getter_return.rs b/src/rules/getter_return.rs index a59f48d86..df982fd05 100644 --- a/src/rules/getter_return.rs +++ b/src/rules/getter_return.rs @@ -26,15 +26,15 @@ const CODE: &str = "getter-return"; #[derive(Display)] enum GetterReturnMessage { - #[display(fmt = "Expected to return a value in '{}'.", _0)] + #[display("Expected to return a value in '{}'.", _0)] Expected(String), - #[display(fmt = "Expected '{}' to always return a value.", _0)] + #[display("Expected '{}' to always return a value.", _0)] ExpectedAlways(String), } #[derive(Display)] enum GetterReturnHint { - #[display(fmt = "Return a value from the getter function")] + #[display("Return a value from the getter function")] Return, } diff --git a/src/rules/no_compare_neg_zero.rs b/src/rules/no_compare_neg_zero.rs index 706243f1f..2c80f13ab 100644 --- a/src/rules/no_compare_neg_zero.rs +++ b/src/rules/no_compare_neg_zero.rs @@ -19,13 +19,13 @@ const CODE: &str = "no-compare-neg-zero"; #[derive(Display)] enum NoCompareNegZeroMessage { - #[display(fmt = "Do not compare against -0")] + #[display("Do not compare against -0")] Unexpected, } #[derive(Display)] enum NoCompareNegZeroHint { - #[display(fmt = "Use Object.is(x, -0) instead")] + #[display("Use Object.is(x, -0) instead")] ObjectIs, } diff --git a/src/rules/no_cond_assign.rs b/src/rules/no_cond_assign.rs index 720d81de0..752c8319a 100644 --- a/src/rules/no_cond_assign.rs +++ b/src/rules/no_cond_assign.rs @@ -14,16 +14,14 @@ const CODE: &str = "no-cond-assign"; #[derive(Display)] enum NoCondAssignMessage { - #[display( - fmt = "Expected a conditional expression and instead saw an assignment" - )] + #[display("Expected a conditional expression and instead saw an assignment")] Unexpected, } #[derive(Display)] enum NoCondAssignHint { #[display( - fmt = "Change assignment (`=`) to comparison (`===`) or move assignment out of condition" + "Change assignment (`=`) to comparison (`===`) or move assignment out of condition" )] ChangeOrMove, } diff --git a/src/rules/no_const_assign.rs b/src/rules/no_const_assign.rs index af8f5903a..83984d05d 100644 --- a/src/rules/no_const_assign.rs +++ b/src/rules/no_const_assign.rs @@ -17,14 +17,14 @@ const CODE: &str = "no-const-assign"; #[derive(Display)] enum NoConstantAssignMessage { - #[display(fmt = "Reassigning constant variable is not allowed")] + #[display("Reassigning constant variable is not allowed")] Unexpected, } #[derive(Display)] enum NoConstantAssignHint { #[display( - fmt = "Change `const` declaration to `let` or double check the correct variable is used" + "Change `const` declaration to `let` or double check the correct variable is used" )] Remove, } diff --git a/src/rules/no_constant_condition.rs b/src/rules/no_constant_condition.rs index aca8c04a7..f3806e858 100644 --- a/src/rules/no_constant_condition.rs +++ b/src/rules/no_constant_condition.rs @@ -17,15 +17,13 @@ const CODE: &str = "no-constant-condition"; #[derive(Display)] enum NoConstantConditionMessage { - #[display( - fmt = "Use of a constant expressions as conditions is not allowed." - )] + #[display("Use of a constant expressions as conditions is not allowed.")] Unexpected, } #[derive(Display)] enum NoConstantConditionHint { - #[display(fmt = "Remove the constant expression")] + #[display("Remove the constant expression")] Remove, } diff --git a/src/rules/no_control_regex.rs b/src/rules/no_control_regex.rs index 97f42702b..ba3742123 100644 --- a/src/rules/no_control_regex.rs +++ b/src/rules/no_control_regex.rs @@ -18,7 +18,7 @@ const CODE: &str = "no-control-regex"; #[derive(Display)] enum NoControlRegexMessage { #[display( - fmt = "Unexpected control character(s) in regular expression: \\x{:x}.", + "Unexpected control character(s) in regular expression: \\x{:x}.", _0 )] Unexpected(u64), @@ -27,7 +27,7 @@ enum NoControlRegexMessage { #[derive(Display)] enum NoControlRegexHint { #[display( - fmt = "Disable the rule if the control character (\\x... or \\u00..) was intentional, otherwise rework your RegExp" + "Disable the rule if the control character (\\x... or \\u00..) was intentional, otherwise rework your RegExp" )] DisableOrRework, } diff --git a/src/rules/no_debugger.rs b/src/rules/no_debugger.rs index 0c7c8c342..7884a5ed0 100644 --- a/src/rules/no_debugger.rs +++ b/src/rules/no_debugger.rs @@ -14,13 +14,13 @@ const CODE: &str = "no-debugger"; #[derive(Display)] enum NoDebuggerMessage { - #[display(fmt = "`debugger` statement is not allowed")] + #[display("`debugger` statement is not allowed")] Unexpected, } #[derive(Display)] enum NoDebuggerHint { - #[display(fmt = "Remove the `debugger` statement")] + #[display("Remove the `debugger` statement")] Remove, } diff --git a/src/rules/no_delete_var.rs b/src/rules/no_delete_var.rs index 98e5bd30f..73e79692f 100644 --- a/src/rules/no_delete_var.rs +++ b/src/rules/no_delete_var.rs @@ -14,13 +14,13 @@ const CODE: &str = "no-delete-var"; #[derive(Display)] enum NoDeleteVarMessage { - #[display(fmt = "Variables shouldn't be deleted")] + #[display("Variables shouldn't be deleted")] Unexpected, } #[derive(Display)] enum NoDeleteVarHint { - #[display(fmt = "Remove the deletion statement")] + #[display("Remove the deletion statement")] Remove, } diff --git a/src/rules/no_dupe_args.rs b/src/rules/no_dupe_args.rs index dd5a27780..daee38e33 100644 --- a/src/rules/no_dupe_args.rs +++ b/src/rules/no_dupe_args.rs @@ -15,13 +15,13 @@ const CODE: &str = "no-dupe-args"; #[derive(Display)] enum NoDupeArgsMessage { - #[display(fmt = "Duplicate arguments not allowed")] + #[display("Duplicate arguments not allowed")] Unexpected, } #[derive(Display)] enum NoDupeArgsHint { - #[display(fmt = "Rename or remove the duplicate (e.g. same name) argument")] + #[display("Rename or remove the duplicate (e.g. same name) argument")] RenameOrRemove, } diff --git a/src/rules/no_dupe_class_members.rs b/src/rules/no_dupe_class_members.rs index d176061f2..62f5d1f51 100644 --- a/src/rules/no_dupe_class_members.rs +++ b/src/rules/no_dupe_class_members.rs @@ -22,13 +22,13 @@ const CODE: &str = "no-dupe-class-members"; #[derive(Display)] enum NoDupeClassMembersMessage { - #[display(fmt = "Duplicate name '{}'", _0)] + #[display("Duplicate name '{}'", _0)] Duplicate(String), } #[derive(Display)] enum NoDupeClassMembersHint { - #[display(fmt = "Rename or remove the function with the duplicated name")] + #[display("Rename or remove the function with the duplicated name")] RenameOrRemove, } diff --git a/src/rules/no_dupe_else_if.rs b/src/rules/no_dupe_else_if.rs index 49791cc0d..c9884531c 100644 --- a/src/rules/no_dupe_else_if.rs +++ b/src/rules/no_dupe_else_if.rs @@ -19,16 +19,14 @@ const CODE: &str = "no-dupe-else-if"; #[derive(Display)] enum NoDupeElseIfMessage { #[display( - fmt = "This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain." + "This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain." )] Unexpected, } #[derive(Display)] enum NoDupeElseIfHint { - #[display( - fmt = "Remove or rework the `else if` condition which is duplicated" - )] + #[display("Remove or rework the `else if` condition which is duplicated")] RemoveOrRework, } diff --git a/src/rules/no_dupe_keys.rs b/src/rules/no_dupe_keys.rs index fafe65b95..e8332cb3a 100644 --- a/src/rules/no_dupe_keys.rs +++ b/src/rules/no_dupe_keys.rs @@ -20,13 +20,13 @@ const CODE: &str = "no-dupe-keys"; #[derive(Display)] enum NoDupeKeysMessage { - #[display(fmt = "Duplicate key '{}'", _0)] + #[display("Duplicate key '{}'", _0)] Duplicate(String), } #[derive(Display)] enum NoDupeKeysHint { - #[display(fmt = "Remove or rename the duplicate key")] + #[display("Remove or rename the duplicate key")] RemoveOrRename, } diff --git a/src/rules/no_duplicate_case.rs b/src/rules/no_duplicate_case.rs index 4d46b3344..06a9f9acf 100644 --- a/src/rules/no_duplicate_case.rs +++ b/src/rules/no_duplicate_case.rs @@ -19,13 +19,13 @@ const CODE: &str = "no-duplicate-case"; #[derive(Display)] enum NoDuplicateCaseMessage { - #[display(fmt = "Duplicate values in `case` are not allowed")] + #[display("Duplicate values in `case` are not allowed")] Unexpected, } #[derive(Display)] enum NoDuplicateCaseHint { - #[display(fmt = "Remove or rename the duplicate case clause")] + #[display("Remove or rename the duplicate case clause")] RemoveOrRename, } diff --git a/src/rules/no_empty_interface.rs b/src/rules/no_empty_interface.rs index f9f38e30d..528d2601a 100644 --- a/src/rules/no_empty_interface.rs +++ b/src/rules/no_empty_interface.rs @@ -14,13 +14,13 @@ const CODE: &str = "no-empty-interface"; #[derive(Display)] enum NoEmptyInterfaceMessage { - #[display(fmt = "An empty interface is equivalent to `{{}}`.")] + #[display("An empty interface is equivalent to `{{}}`.")] EmptyObject, } #[derive(Display)] enum NoEmptyInterfaceHint { - #[display(fmt = "Remove this interface or add members to this interface.")] + #[display("Remove this interface or add members to this interface.")] RemoveOrAddMember, } diff --git a/src/rules/no_ex_assign.rs b/src/rules/no_ex_assign.rs index aa944e1ad..d81cff0ed 100644 --- a/src/rules/no_ex_assign.rs +++ b/src/rules/no_ex_assign.rs @@ -17,13 +17,13 @@ const CODE: &str = "no-ex-assign"; #[derive(Display)] enum NoExAssignMessage { - #[display(fmt = "Reassigning exception parameter is not allowed")] + #[display("Reassigning exception parameter is not allowed")] NotAllowed, } #[derive(Display)] enum NoExAssignHint { - #[display(fmt = "Use a different variable for the assignment")] + #[display("Use a different variable for the assignment")] UseDifferent, } diff --git a/src/rules/no_external_imports.rs b/src/rules/no_external_imports.rs index fc18ee1ed..8195a15f5 100644 --- a/src/rules/no_external_imports.rs +++ b/src/rules/no_external_imports.rs @@ -15,13 +15,13 @@ const CODE: &str = "no-external-import"; #[derive(Display)] enum NoExternalImportMessage { - #[display(fmt = "Not allowed to import external resources")] + #[display("Not allowed to import external resources")] Unexpected, } #[derive(Display)] enum NoExternalImportHint { - #[display(fmt = "Create a deps.ts file or use import maps")] + #[display("Create a deps.ts file or use import maps")] CreateDependencyFile, } diff --git a/src/rules/no_extra_boolean_cast.rs b/src/rules/no_extra_boolean_cast.rs index 3eff036c8..7bb94126a 100644 --- a/src/rules/no_extra_boolean_cast.rs +++ b/src/rules/no_extra_boolean_cast.rs @@ -19,17 +19,17 @@ const CODE: &str = "no-extra-boolean-cast"; #[derive(Display)] enum NoExtraBooleanCastMessage { - #[display(fmt = "Redundant Boolean call.")] + #[display("Redundant Boolean call.")] BooleanCall, - #[display(fmt = "Redundant double negation.")] + #[display("Redundant double negation.")] DoubleNegation, } #[derive(Display)] enum NoExtraBooleanCastHint { - #[display(fmt = "Remove the Boolean call, it is unnecessary")] + #[display("Remove the Boolean call, it is unnecessary")] BooleanCall, - #[display(fmt = "Remove the double negation (`!!`), it is unnecessary")] + #[display("Remove the double negation (`!!`), it is unnecessary")] DoubleNegation, } diff --git a/src/rules/no_extra_non_null_assertion.rs b/src/rules/no_extra_non_null_assertion.rs index a245a31e5..1d22ba7df 100644 --- a/src/rules/no_extra_non_null_assertion.rs +++ b/src/rules/no_extra_non_null_assertion.rs @@ -21,13 +21,13 @@ const CODE: &str = "no-extra-non-null-assertion"; #[derive(Display)] enum NoExtraNonNullAssertionMessage { - #[display(fmt = "Extra non-null assertion is forbidden")] + #[display("Extra non-null assertion is forbidden")] Unexpected, } #[derive(Display)] enum NoExtraNonNullAssertionHint { - #[display(fmt = "Remove the extra non-null assertion operator (`!`)")] + #[display("Remove the extra non-null assertion operator (`!`)")] Remove, } diff --git a/src/rules/no_fallthrough.rs b/src/rules/no_fallthrough.rs index 05ec0b3eb..e4bf01368 100644 --- a/src/rules/no_fallthrough.rs +++ b/src/rules/no_fallthrough.rs @@ -19,14 +19,14 @@ const CODE: &str = "no-fallthrough"; #[derive(Display)] enum NoFallthroughMessage { - #[display(fmt = "Fallthrough is not allowed")] + #[display("Fallthrough is not allowed")] Unexpected, } #[derive(Display)] enum NoFallthroughHint { #[display( - fmt = "Add `break` or comment `/* falls through */` to your case statement" + "Add `break` or comment `/* falls through */` to your case statement" )] BreakOrComment, } diff --git a/src/rules/no_func_assign.rs b/src/rules/no_func_assign.rs index 764239b8b..abba6f127 100644 --- a/src/rules/no_func_assign.rs +++ b/src/rules/no_func_assign.rs @@ -15,15 +15,13 @@ const CODE: &str = "no-func-assign"; #[derive(Display)] enum NoFuncAssignMessage { - #[display(fmt = "Reassigning function declaration is not allowed")] + #[display("Reassigning function declaration is not allowed")] Unexpected, } #[derive(Display)] enum NoFuncAssignHint { - #[display( - fmt = "Remove or rework the reassignment of the existing function" - )] + #[display("Remove or rework the reassignment of the existing function")] RemoveOrRework, } diff --git a/src/rules/no_global_assign.rs b/src/rules/no_global_assign.rs index 226f13ddc..0ff34083a 100644 --- a/src/rules/no_global_assign.rs +++ b/src/rules/no_global_assign.rs @@ -17,13 +17,13 @@ const CODE: &str = "no-global-assign"; #[derive(Display)] enum NoGlobalAssignMessage { - #[display(fmt = "Assignment to global is not allowed")] + #[display("Assignment to global is not allowed")] NotAllowed, } #[derive(Display)] enum NoGlobalAssignHint { - #[display(fmt = "Remove the assignment to the global variable")] + #[display("Remove the assignment to the global variable")] Remove, } diff --git a/src/rules/no_inferrable_types.rs b/src/rules/no_inferrable_types.rs index 8e3320a6d..c6f4d3b85 100644 --- a/src/rules/no_inferrable_types.rs +++ b/src/rules/no_inferrable_types.rs @@ -22,13 +22,13 @@ const CODE: &str = "no-inferrable-types"; #[derive(Display)] enum NoInferrableTypesMessage { - #[display(fmt = "inferrable types are not allowed")] + #[display("inferrable types are not allowed")] NotAllowed, } #[derive(Display)] enum NoInferrableTypesHint { - #[display(fmt = "Remove the type, it is easily inferrable")] + #[display("Remove the type, it is easily inferrable")] Remove, } diff --git a/src/rules/no_inner_declarations.rs b/src/rules/no_inner_declarations.rs index 2212a81d4..daa424b64 100644 --- a/src/rules/no_inner_declarations.rs +++ b/src/rules/no_inner_declarations.rs @@ -21,13 +21,13 @@ const CODE: &str = "no-inner-declarations"; #[derive(Display)] enum NoInnerDeclarationsMessage { - #[display(fmt = "Move {} declaration to {} root", _0, _1)] + #[display("Move {} declaration to {} root", _0, _1)] Move(String, String), } #[derive(Display)] enum NoInnerDeclarationsHint { - #[display(fmt = "Move the declaration up into the correct scope")] + #[display("Move the declaration up into the correct scope")] Move, } diff --git a/src/rules/no_irregular_whitespace.rs b/src/rules/no_irregular_whitespace.rs index 8eec87616..f7dac7d5a 100644 --- a/src/rules/no_irregular_whitespace.rs +++ b/src/rules/no_irregular_whitespace.rs @@ -16,7 +16,7 @@ const HINT: &str = "Change to a normal space or tab"; #[derive(Display)] enum NoIrregularWhitespaceMessage { - #[display(fmt = "Irregular whitespace not allowed.")] + #[display("Irregular whitespace not allowed.")] NotAllowed, } diff --git a/src/rules/no_misused_new.rs b/src/rules/no_misused_new.rs index 047da9781..a1695dcbb 100644 --- a/src/rules/no_misused_new.rs +++ b/src/rules/no_misused_new.rs @@ -18,21 +18,21 @@ const CODE: &str = "no-misused-new"; #[derive(Display)] enum NoMisusedNewMessage { - #[display(fmt = "Type aliases cannot be constructed, only classes")] + #[display("Type aliases cannot be constructed, only classes")] TypeAlias, - #[display(fmt = "Interfaces cannot be constructed, only classes")] + #[display("Interfaces cannot be constructed, only classes")] Interface, - #[display(fmt = "Class cannot have method named `new`.")] + #[display("Class cannot have method named `new`.")] NewMethod, } #[derive(Display)] enum NoMisusedNewHint { - #[display(fmt = "Consider using a class, not a type")] + #[display("Consider using a class, not a type")] NotType, - #[display(fmt = "Consider using a class, not an interface")] + #[display("Consider using a class, not an interface")] NotInterface, - #[display(fmt = "Rename the method")] + #[display("Rename the method")] RenameMethod, } diff --git a/src/rules/no_non_null_asserted_optional_chain.rs b/src/rules/no_non_null_asserted_optional_chain.rs index 967503a34..d8b5a43a2 100644 --- a/src/rules/no_non_null_asserted_optional_chain.rs +++ b/src/rules/no_non_null_asserted_optional_chain.rs @@ -15,7 +15,7 @@ const CODE: &str = "no-non-null-asserted-optional-chain"; #[derive(Display)] enum NoNonNullAssertedOptionalChainMessage { #[display( - fmt = "Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong." + "Optional chain expressions can return undefined by design - using a non-null assertion is unsafe and wrong." )] WrongAssertion, } diff --git a/src/rules/no_non_null_assertion.rs b/src/rules/no_non_null_assertion.rs index 257c8a1ee..a8d96ee9b 100644 --- a/src/rules/no_non_null_assertion.rs +++ b/src/rules/no_non_null_assertion.rs @@ -14,7 +14,7 @@ const CODE: &str = "no-non-null-assertion"; #[derive(Display)] enum NoNonNullAssertionMessage { - #[display(fmt = "do not use non-null assertion")] + #[display("do not use non-null assertion")] Unexpected, } diff --git a/src/rules/no_self_assign.rs b/src/rules/no_self_assign.rs index 7b62cbd66..c775c360a 100644 --- a/src/rules/no_self_assign.rs +++ b/src/rules/no_self_assign.rs @@ -27,15 +27,13 @@ const CODE: &str = "no-self-assign"; #[derive(Display)] enum NoSelfAssignMessage { - #[display(fmt = "`{}` is assigned to itself", _0)] + #[display("`{}` is assigned to itself", _0)] Invalid(String), } #[derive(Display)] enum NoSelfAssignHint { - #[display( - fmt = "Self assignments have no effect. Perhaps you made a mistake?" - )] + #[display("Self assignments have no effect. Perhaps you made a mistake?")] Mistake, } diff --git a/src/rules/no_self_compare.rs b/src/rules/no_self_compare.rs index 805db35fc..754999fc6 100644 --- a/src/rules/no_self_compare.rs +++ b/src/rules/no_self_compare.rs @@ -16,7 +16,7 @@ const HINT: &str = #[derive(Display)] enum NoSelfCompareMessage { - #[display(fmt = "`{}` is compared to itself", _0)] + #[display("`{}` is compared to itself", _0)] Invalid(String), } diff --git a/src/rules/no_shadow_restricted_names.rs b/src/rules/no_shadow_restricted_names.rs index 57f54633d..fb72a4bac 100644 --- a/src/rules/no_shadow_restricted_names.rs +++ b/src/rules/no_shadow_restricted_names.rs @@ -17,7 +17,7 @@ const CODE: &str = "no-shadow-restricted-names"; #[derive(Display)] enum NoShadowRestrictedNamesMessage { - #[display(fmt = "Shadowing of global property {}", _0)] + #[display("Shadowing of global property {}", _0)] Shadowing(String), } diff --git a/src/rules/no_sparse_arrays.rs b/src/rules/no_sparse_arrays.rs index 3c2254b00..69b6e539f 100644 --- a/src/rules/no_sparse_arrays.rs +++ b/src/rules/no_sparse_arrays.rs @@ -14,7 +14,7 @@ const CODE: &str = "no-sparse-arrays"; #[derive(Display)] enum NoSparseArraysMessage { - #[display(fmt = "Sparse arrays are not allowed")] + #[display("Sparse arrays are not allowed")] Disallowed, } diff --git a/src/rules/no_throw_literal.rs b/src/rules/no_throw_literal.rs index 81f1fc018..74078d04d 100644 --- a/src/rules/no_throw_literal.rs +++ b/src/rules/no_throw_literal.rs @@ -14,10 +14,10 @@ const CODE: &str = "no-throw-literal"; #[derive(Display)] enum NoThrowLiteralMessage { - #[display(fmt = "expected an error object to be thrown")] + #[display("expected an error object to be thrown")] ErrObjectExpected, - #[display(fmt = "do not throw undefined")] + #[display("do not throw undefined")] Undefined, } diff --git a/src/rules/no_unsafe_finally.rs b/src/rules/no_unsafe_finally.rs index fbd496640..2af1f8bb7 100644 --- a/src/rules/no_unsafe_finally.rs +++ b/src/rules/no_unsafe_finally.rs @@ -16,13 +16,13 @@ will most likely lead to undesired behavior."; #[derive(Display)] enum NoUnsafeFinallyMessage { - #[display(fmt = "Unsafe usage of break statement")] + #[display("Unsafe usage of break statement")] Break, - #[display(fmt = "Unsafe usage of continue statement")] + #[display("Unsafe usage of continue statement")] Continue, - #[display(fmt = "Unsafe usage of return statement")] + #[display("Unsafe usage of return statement")] Return, - #[display(fmt = "Unsafe usage of throw statement")] + #[display("Unsafe usage of throw statement")] Throw, } diff --git a/src/rules/no_unsafe_negation.rs b/src/rules/no_unsafe_negation.rs index 35e5ec214..77f76195e 100644 --- a/src/rules/no_unsafe_negation.rs +++ b/src/rules/no_unsafe_negation.rs @@ -14,7 +14,7 @@ const CODE: &str = "no-unsafe-negation"; #[derive(Display)] enum NoUnsafeNegationMessage { - #[display(fmt = "Unexpected negating the left operand of `{}` operator", _0)] + #[display("Unexpected negating the left operand of `{}` operator", _0)] Unexpected(String), } diff --git a/src/rules/no_unused_labels.rs b/src/rules/no_unused_labels.rs index 6b4004b8f..f46eb0123 100644 --- a/src/rules/no_unused_labels.rs +++ b/src/rules/no_unused_labels.rs @@ -14,7 +14,7 @@ const CODE: &str = "no-unused-labels"; #[derive(Display)] enum NoUnusedLabelsMessage { - #[display(fmt = "`{}` label is never used", _0)] + #[display("`{}` label is never used", _0)] Unused(String), } diff --git a/src/rules/no_unused_vars.rs b/src/rules/no_unused_vars.rs index 692d3d16e..7d7c9b262 100644 --- a/src/rules/no_unused_vars.rs +++ b/src/rules/no_unused_vars.rs @@ -35,19 +35,19 @@ const CODE: &str = "no-unused-vars"; #[derive(Display)] enum NoUnusedVarsMessage { - #[display(fmt = "`{}` is never used", _0)] + #[display("`{}` is never used", _0)] NeverUsed(String), } #[derive(Display)] enum NoUnusedVarsHint { #[display( - fmt = "If this is intentional, prefix it with an underscore like `_{}`", + "If this is intentional, prefix it with an underscore like `_{}`", _0 )] AddPrefix(String), #[display( - fmt = "If this is intentional, alias it with an underscore like `{} as _{}`", + "If this is intentional, alias it with an underscore like `{} as _{}`", _0, _0 )] diff --git a/src/rules/prefer_as_const.rs b/src/rules/prefer_as_const.rs index 7d489efae..3563d9bc2 100644 --- a/src/rules/prefer_as_const.rs +++ b/src/rules/prefer_as_const.rs @@ -15,14 +15,14 @@ const CODE: &str = "prefer-as-const"; #[derive(Display)] enum PreferAsConstMessage { #[display( - fmt = "Expected a `const` assertion instead of a literal type annotation" + "Expected a `const` assertion instead of a literal type annotation" )] ExpectedConstAssertion, } #[derive(Display)] enum PreferAsConstHint { - #[display(fmt = "Remove a literal type annotation and add `as const`")] + #[display("Remove a literal type annotation and add `as const`")] AddAsConst, } diff --git a/src/rules/prefer_const.rs b/src/rules/prefer_const.rs index a251579bd..46540a254 100644 --- a/src/rules/prefer_const.rs +++ b/src/rules/prefer_const.rs @@ -33,13 +33,13 @@ const CODE: &str = "prefer-const"; #[derive(Display)] enum PreferConstMessage { - #[display(fmt = "`{}` is never reassigned", _0)] + #[display("`{}` is never reassigned", _0)] NeverReassigned(String), } #[derive(Display)] enum PreferConstHint { - #[display(fmt = "Use `const` instead")] + #[display("Use `const` instead")] UseConst, } diff --git a/src/rules/prefer_primordials.rs b/src/rules/prefer_primordials.rs index 52b2898dd..dfec3addf 100644 --- a/src/rules/prefer_primordials.rs +++ b/src/rules/prefer_primordials.rs @@ -17,40 +17,38 @@ const CODE: &str = "prefer-primordials"; #[derive(Display)] enum PreferPrimordialsMessage { - #[display(fmt = "Don't use the global intrinsic")] + #[display("Don't use the global intrinsic")] GlobalIntrinsic, - #[display(fmt = "Don't use the unsafe intrinsic")] + #[display("Don't use the unsafe intrinsic")] UnsafeIntrinsic, - #[display(fmt = "Don't use iterator protocol directly")] + #[display("Don't use iterator protocol directly")] Iterator, - #[display(fmt = "Don't use RegExp literal directly")] + #[display("Don't use RegExp literal directly")] RegExp, - #[display(fmt = "Don't use `instanceof` operator")] + #[display("Don't use `instanceof` operator")] InstanceOf, - #[display(fmt = "Don't use `in` operator")] + #[display("Don't use `in` operator")] In, } #[derive(Display)] enum PreferPrimordialsHint { - #[display(fmt = "Instead use the equivalent from the `primordials` object")] + #[display("Instead use the equivalent from the `primordials` object")] GlobalIntrinsic, - #[display( - fmt = "Instead use the safe wrapper from the `primordials` object" - )] + #[display("Instead use the safe wrapper from the `primordials` object")] UnsafeIntrinsic, - #[display(fmt = "Wrap a SafeIterator from the `primordials` object")] + #[display("Wrap a SafeIterator from the `primordials` object")] SafeIterator, - #[display(fmt = "Wrap `SafeRegExp` from the `primordials` object")] + #[display("Wrap `SafeRegExp` from the `primordials` object")] SafeRegExp, - #[display(fmt = "Instead use the object pattern destructuring assignment")] + #[display("Instead use the object pattern destructuring assignment")] ObjectPattern, #[display( - fmt = "Instead use `ObjectPrototypeIsPrototypeOf` from the `primordials` object" + "Instead use `ObjectPrototypeIsPrototypeOf` from the `primordials` object" )] InstanceOf, #[display( - fmt = "Instead use either `ObjectHasOwn` or `ReflectHas` from the `primordials` object" + "Instead use either `ObjectHasOwn` or `ReflectHas` from the `primordials` object" )] In, } diff --git a/src/rules/require_await.rs b/src/rules/require_await.rs index 713a83cd0..193f52aa3 100644 --- a/src/rules/require_await.rs +++ b/src/rules/require_await.rs @@ -19,25 +19,25 @@ const CODE: &str = "require-await"; #[derive(Display)] enum RequireAwaitMessage { #[display( - fmt = "Async function '{}' has no 'await' expression or 'await using' declaration.", + "Async function '{}' has no 'await' expression or 'await using' declaration.", _0 )] Function(String), #[display( - fmt = "Async function has no 'await' expression or 'await using' declaration." + "Async function has no 'await' expression or 'await using' declaration." )] AnonymousFunction, #[display( - fmt = "Async arrow function has no 'await' expression or 'await using' declaration." + "Async arrow function has no 'await' expression or 'await using' declaration." )] ArrowFunction, #[display( - fmt = "Async method '{}' has no 'await' expression or 'await using' declaration.", + "Async method '{}' has no 'await' expression or 'await using' declaration.", _0 )] Method(String), #[display( - fmt = "Async method has no 'await' expression or 'await using' declaration." + "Async method has no 'await' expression or 'await using' declaration." )] AnonymousMethod, } @@ -45,7 +45,7 @@ enum RequireAwaitMessage { #[derive(Display)] enum RequireAwaitHint { #[display( - fmt = "Remove 'async' keyword from the function or use 'await' expression or 'await using' declaration inside." + "Remove 'async' keyword from the function or use 'await' expression or 'await using' declaration inside." )] RemoveOrUse, } diff --git a/src/rules/single_var_declarator.rs b/src/rules/single_var_declarator.rs index 24f381744..d1c81e3dd 100644 --- a/src/rules/single_var_declarator.rs +++ b/src/rules/single_var_declarator.rs @@ -17,7 +17,7 @@ const CODE: &str = "single-var-declarator"; #[derive(Display)] enum SingleVarDeclaratorMessage { - #[display(fmt = "Multiple variable declarators are not allowed")] + #[display("Multiple variable declarators are not allowed")] Unexpected, } diff --git a/src/rules/triple_slash_reference.rs b/src/rules/triple_slash_reference.rs index 52ba72911..12091d475 100644 --- a/src/rules/triple_slash_reference.rs +++ b/src/rules/triple_slash_reference.rs @@ -17,7 +17,7 @@ const CODE: &str = "triple-slash-reference"; #[derive(Display)] enum TripleSlashReferenceMessage { - #[display(fmt = "`triple slash reference` is not allowed")] + #[display("`triple slash reference` is not allowed")] Unexpected, } diff --git a/src/rules/use_isnan.rs b/src/rules/use_isnan.rs index 3404ca8da..a7f9ca7a1 100644 --- a/src/rules/use_isnan.rs +++ b/src/rules/use_isnan.rs @@ -14,17 +14,15 @@ const CODE: &str = "use-isnan"; #[derive(Display)] enum UseIsNaNMessage { - #[display(fmt = "Use the isNaN function to compare with NaN")] + #[display("Use the isNaN function to compare with NaN")] Comparison, #[display( - fmt = "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch" + "'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch" )] SwitchUnmatched, - #[display( - fmt = "'case NaN' can never match. Use Number.isNaN before the switch" - )] + #[display("'case NaN' can never match. Use Number.isNaN before the switch")] CaseUnmatched, } diff --git a/src/rules/verbatim_module_syntax.rs b/src/rules/verbatim_module_syntax.rs index 93bae01f4..52bf92223 100644 --- a/src/rules/verbatim_module_syntax.rs +++ b/src/rules/verbatim_module_syntax.rs @@ -22,25 +22,25 @@ const FIX_DESC: &str = "Add a type keyword"; #[allow(clippy::enum_variant_names)] #[derive(Display)] enum Message { - #[display(fmt = "All import identifiers are used in types")] + #[display("All import identifiers are used in types")] AllImportIdentsUsedInTypes, - #[display(fmt = "Import identifier only used in types")] + #[display("Import identifier only used in types")] ImportIdentUsedInTypes, - #[display(fmt = "All export identifiers are used in types")] + #[display("All export identifiers are used in types")] AllExportIdentsUsedInTypes, - #[display(fmt = "Export identifier only used in types")] + #[display("Export identifier only used in types")] ExportIdentUsedInTypes, } #[derive(Display)] enum Hint { #[display( - fmt = "Change `import` to `import type` and optionally add an explicit side effect import" + "Change `import` to `import type` and optionally add an explicit side effect import" )] ChangeImportToImportType, - #[display(fmt = "Change `export` to `export type`")] + #[display("Change `export` to `export type`")] ChangeExportToExportType, - #[display(fmt = "Add a `type` keyword before the identifier")] + #[display("Add a `type` keyword before the identifier")] AddTypeKeyword, }