diff --git a/Cargo.lock b/Cargo.lock index 175fe6c1..74e92061 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 787b86e7..51932a8f 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 7ea7cdd2..07d43143 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 49922e5b..6aac0534 100644 --- a/src/rules/default_param_last.rs +++ b/src/rules/default_param_last.rs @@ -13,14 +13,14 @@ 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" + "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 128b3708..56648396 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 6003b373..fa111936 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 f153d98d..b489b6f4 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 a59f48d8..df982fd0 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 706243f1..2c80f13a 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 720d81de..58451efc 100644 --- a/src/rules/no_cond_assign.rs +++ b/src/rules/no_cond_assign.rs @@ -15,7 +15,7 @@ const CODE: &str = "no-cond-assign"; #[derive(Display)] enum NoCondAssignMessage { #[display( - fmt = "Expected a conditional expression and instead saw an assignment" + "Expected a conditional expression and instead saw an assignment" )] Unexpected, } @@ -23,7 +23,7 @@ enum NoCondAssignMessage { #[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 af8f5903..83984d05 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 aca8c04a..b981c7db 100644 --- a/src/rules/no_constant_condition.rs +++ b/src/rules/no_constant_condition.rs @@ -18,14 +18,14 @@ const CODE: &str = "no-constant-condition"; #[derive(Display)] enum NoConstantConditionMessage { #[display( - fmt = "Use of a constant expressions as conditions is not allowed." + "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 97f42702..ba374212 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 0c7c8c34..7884a5ed 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 98e5bd30..73e79692 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 dd5a2778..daee38e3 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 d176061f..62f5d1f5 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 49791cc0..f3523344 100644 --- a/src/rules/no_dupe_else_if.rs +++ b/src/rules/no_dupe_else_if.rs @@ -19,7 +19,7 @@ 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, } @@ -27,7 +27,7 @@ enum NoDupeElseIfMessage { #[derive(Display)] enum NoDupeElseIfHint { #[display( - fmt = "Remove or rework the `else if` condition which is duplicated" + "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 fafe65b9..e8332cb3 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 4d46b334..06a9f9ac 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 f9f38e30..528d2601 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 aa944e1a..d81cff0e 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 fc18ee1e..8195a15f 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 3eff036c..7bb94126 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 a245a31e..1d22ba7d 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 05ec0b3e..e4bf0136 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 764239b8..b0c34d17 100644 --- a/src/rules/no_func_assign.rs +++ b/src/rules/no_func_assign.rs @@ -15,14 +15,14 @@ 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" + "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 226f13dd..0ff34083 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 8e3320a6..c6f4d3b8 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 2212a81d..daa424b6 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 8eec8761..f7dac7d5 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 047da978..a1695dcb 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 967503a3..d8b5a43a 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 257c8a1e..a8d96ee9 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 7b62cbd6..9abb038d 100644 --- a/src/rules/no_self_assign.rs +++ b/src/rules/no_self_assign.rs @@ -27,14 +27,14 @@ 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?" + "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 805db35f..754999fc 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 57f54633..fb72a4ba 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 3c2254b0..69b6e539 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 81f1fc01..74078d04 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 fbd49664..2af1f8bb 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 35e5ec21..77f76195 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 6b4004b8..f46eb012 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 692d3d16..7d7c9b26 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 7d489efa..3563d9bc 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 a251579b..46540a25 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 52b2898d..95985657 100644 --- a/src/rules/prefer_primordials.rs +++ b/src/rules/prefer_primordials.rs @@ -17,40 +17,40 @@ 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" + "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 713a83cd..193f52aa 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 24f38174..d1c81e3d 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 52ba7291..12091d47 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 3404ca8d..4aa54c46 100644 --- a/src/rules/use_isnan.rs +++ b/src/rules/use_isnan.rs @@ -14,16 +14,16 @@ 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" + "'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 93bae01f..52bf9222 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, }