diff --git a/Cargo.toml b/Cargo.toml index 4f3c7b9e676e3..f1d474fe99a09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ non_ascii_idents = "warn" unit-bindings = "warn" [workspace.lints.clippy] -all = { level = "warn" } +all = { level = "warn", priority = -1 } empty_docs = { level = "allow", priority = 1 } # from `Tsify` # restriction dbg_macro = "warn" diff --git a/crates/oxc_linter/src/rules/unicorn/no_zero_fractions.rs b/crates/oxc_linter/src/rules/unicorn/no_zero_fractions.rs index 27f78d0301fc3..55064ee6a885e 100644 --- a/crates/oxc_linter/src/rules/unicorn/no_zero_fractions.rs +++ b/crates/oxc_linter/src/rules/unicorn/no_zero_fractions.rs @@ -80,8 +80,7 @@ fn format_raw(raw: &str) -> Option<(String, bool)> { let dot_and_fractions = after_parts.next()?; let after = after_parts.next().unwrap_or(""); - let fixed_dot_and_fractions = - dot_and_fractions.trim_end_matches(|c: char| c == '0' || c == '.' || c == '_'); + let fixed_dot_and_fractions = dot_and_fractions.trim_end_matches(['0', '.', '_']); let formatted = format!( "{}{}{}{}", if before.is_empty() && fixed_dot_and_fractions.is_empty() { "0" } else { before }, diff --git a/crates/oxc_prettier/src/format/mod.rs b/crates/oxc_prettier/src/format/mod.rs index b1b88f3012160..0231b2e4f6895 100644 --- a/crates/oxc_prettier/src/format/mod.rs +++ b/crates/oxc_prettier/src/format/mod.rs @@ -1334,8 +1334,7 @@ impl<'a> Format<'a> for NumericLiteral<'a> { // Remove unnecessary plus and zeroes from scientific notation. if let Some((head, tail)) = string.split_once('e') { let negative = if tail.starts_with('-') { "-" } else { "" }; - let trimmed = - tail.trim_start_matches(|c| c == '+' || c == '-').trim_start_matches('0'); + let trimmed = tail.trim_start_matches(['+', '-']).trim_start_matches('0'); if trimmed.starts_with(|c: char| c.is_ascii_digit()) { string = Cow::Owned(std::format!("{head}e{negative}{trimmed}")); } @@ -1343,11 +1342,7 @@ impl<'a> Format<'a> for NumericLiteral<'a> { // Remove unnecessary scientific notation (1e0). if let Some((head, tail)) = string.split_once('e') { - if tail - .trim_start_matches(|c| c == '+' || c == '-') - .trim_start_matches('0') - .is_empty() - { + if tail.trim_start_matches(['+', '-']).trim_start_matches('0').is_empty() { string = Cow::Owned(head.to_string()); } } diff --git a/crates/oxc_prettier/src/options.rs b/crates/oxc_prettier/src/options.rs index f9e789b0ec337..b9f36f41e62e6 100644 --- a/crates/oxc_prettier/src/options.rs +++ b/crates/oxc_prettier/src/options.rs @@ -47,8 +47,10 @@ pub struct PrettierOptions { pub trailing_comma: TrailingComma, /// Print spaces between brackets in object literals. + /// /// * true - Example: `{ foo: bar }`. /// * false - Example: `{foo: bar}`. + /// /// Default: true pub bracket_spacing: bool, diff --git a/crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs b/crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs index 1a4484367bdeb..ab5ca7e13fc13 100644 --- a/crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs +++ b/crates/oxc_semantic/src/jsdoc/parser/jsdoc_parts.rs @@ -63,8 +63,7 @@ impl<'a> JSDocCommentPart<'a> { let start_trimmed = self.raw.trim_start(); let trimmed_start_offset = base_len - start_trimmed.len(); - let trimmed_end_offset = - trimmed_start_offset + start_trimmed.find(|c| c == '\n').unwrap_or(0); + let trimmed_end_offset = trimmed_start_offset + start_trimmed.find('\n').unwrap_or(0); Span::new( self.span.start + u32::try_from(trimmed_start_offset).unwrap_or_default(), self.span.start + u32::try_from(trimmed_end_offset).unwrap_or_default(), diff --git a/crates/oxc_traverse/src/ancestor.rs b/crates/oxc_traverse/src/ancestor.rs index a008c4d89e907..6c8656d9be28b 100644 --- a/crates/oxc_traverse/src/ancestor.rs +++ b/crates/oxc_traverse/src/ancestor.rs @@ -11,6 +11,7 @@ use std::cell::Cell; use memoffset::offset_of; + use oxc_allocator::{Box, Vec}; #[allow(clippy::wildcard_imports)] use oxc_ast::ast::*; diff --git a/tasks/coverage/src/suite.rs b/tasks/coverage/src/suite.rs index c821c1a8e17d2..3bca755075ce3 100644 --- a/tasks/coverage/src/suite.rs +++ b/tasks/coverage/src/suite.rs @@ -148,7 +148,7 @@ pub trait Suite { let path = path.strip_prefix(test_root).unwrap().to_owned(); // remove the Byte Order Mark in some of the TypeScript files - let code = code.trim_start_matches(|c| c == '\u{feff}').to_string(); + let code = code.trim_start_matches('\u{feff}').to_string(); T::new(path, code) }) .filter(|case| !case.skip_test_case()) diff --git a/tasks/transform_conformance/src/test_case.rs b/tasks/transform_conformance/src/test_case.rs index 9430aa1ec053e..05e05c64e9462 100644 --- a/tasks/transform_conformance/src/test_case.rs +++ b/tasks/transform_conformance/src/test_case.rs @@ -359,7 +359,7 @@ impl ExecTestCase { fn write_to_test_files(&self, content: &str) -> PathBuf { let allocator = Allocator::default(); let new_file_name: String = - normalize_path(self.path.strip_prefix(&packages_root()).unwrap()) + normalize_path(self.path.strip_prefix(packages_root()).unwrap()) .split('/') .collect::>() .join("-");