diff --git a/Cargo.toml b/Cargo.toml index dc49c74bb6b9..7e5b100c055a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ empty_docs = "allow" # there are some false positives inside biome_ multiple_crate_versions = "allow" # pedantic +assigning_clones = "warn" checked_conversions = "warn" cloned_instead_of_copied = "warn" copy_iterator = "warn" @@ -35,10 +36,12 @@ implicit_hasher = "warn" index_refutable_slice = "warn" inefficient_to_string = "warn" invalid_upcast_comparisons = "warn" +iter_filter_is_ok = "warn" iter_not_returning_iterator = "warn" large_stack_arrays = "warn" large_types_passed_by_value = "warn" macro_use_imports = "warn" +manual_is_variant_and = "warn" manual_ok_or = "warn" manual_string_new = "warn" map_flatten = "warn" @@ -50,9 +53,12 @@ needless_bitwise_bool = "warn" needless_continue = "warn" needless_for_each = "warn" no_effect_underscore_binding = "warn" +option_as_ref_cloned = "warn" ref_binding_to_reference = "warn" ref_option_ref = "warn" +single_char_pattern = "warn" stable_sort_primitive = "warn" +str_split_at_newline = "warn" unnecessary_box_returns = "warn" unnecessary_join = "warn" unnested_or_patterns = "warn" @@ -61,15 +67,18 @@ verbose_bit_mask = "warn" zero_sized_map_values = "warn" # restriction -empty_drop = "warn" -float_cmp_const = "warn" -get_unwrap = "warn" -infinite_loop = "warn" -lossy_float_literal = "warn" -rc_buffer = "warn" -rc_mutex = "warn" -rest_pat_in_fully_bound_structs = "warn" -verbose_file_reads = "warn" +cfg_not_test = "warn" +empty_drop = "warn" +empty_enum_variants_with_brackets = "warn" +float_cmp_const = "warn" +get_unwrap = "warn" +infinite_loop = "warn" +lossy_float_literal = "warn" +rc_buffer = "warn" +rc_mutex = "warn" +rest_pat_in_fully_bound_structs = "warn" +string_lit_chars_any = "warn" +verbose_file_reads = "warn" # https://github.com/rustwasm/wasm-bindgen/issues/3944 #mem_forget = "warn" diff --git a/crates/biome_analyze/src/context.rs b/crates/biome_analyze/src/context.rs index b4ff5d224862..08fab91454bd 100644 --- a/crates/biome_analyze/src/context.rs +++ b/crates/biome_analyze/src/context.rs @@ -8,10 +8,7 @@ use std::path::Path; type RuleQueryResult = <::Query as Queryable>::Output; type RuleServiceBag = <::Query as Queryable>::Services; -pub struct RuleContext<'a, R> -where - R: ?Sized + Rule, -{ +pub struct RuleContext<'a, R: Rule> { query_result: &'a RuleQueryResult, root: &'a RuleRoot, bag: &'a ServiceBag, diff --git a/crates/biome_cli/tests/snapshots/main_cases_diagnostics/max_diagnostics_verbose.snap b/crates/biome_cli/tests/snapshots/main_cases_diagnostics/max_diagnostics_verbose.snap index 58520ca8cf30..1c9eac25d999 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_diagnostics/max_diagnostics_verbose.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_diagnostics/max_diagnostics_verbose.snap @@ -22,9 +22,9 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━ # Emitted Messages ```block -src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_3/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_1/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -34,9 +34,9 @@ src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_2/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_5/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -46,9 +46,9 @@ src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_0/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_4/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_0/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -58,9 +58,9 @@ src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_6/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_3/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -70,9 +70,9 @@ src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_7/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_2/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -82,9 +82,9 @@ src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_1/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_4/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -94,9 +94,9 @@ src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_5/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_6/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice @@ -106,9 +106,9 @@ src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━ ``` ```block -src/folder_0/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - i The file src/folder_0/package-lock.json is protected because is handled by another tool. Biome won't process it. + i The file src/folder_7/package-lock.json is protected because is handled by another tool. Biome won't process it. Verbose advice diff --git a/crates/biome_console/src/write/termcolor.rs b/crates/biome_console/src/write/termcolor.rs index 500074311574..cec2b6da1b2b 100644 --- a/crates/biome_console/src/write/termcolor.rs +++ b/crates/biome_console/src/write/termcolor.rs @@ -165,7 +165,7 @@ where // Unicode is currently poorly supported on most Windows // terminal clients, so we always strip emojis in Windows if cfg!(windows) || !self.writer.supports_color() { - let is_ascii = grapheme_is_ascii(grapheme); + let is_ascii = grapheme.is_ascii(); if !is_ascii { let replacement = unicode_to_ascii(grapheme.chars().nth(0).unwrap()); @@ -201,12 +201,6 @@ fn grapheme_is_whitespace(grapheme: &str) -> bool { grapheme.chars().all(|c| c.is_whitespace()) } -/// Determines if a grapheme contains code points which are out of the ASCII -/// range and thus cannot be printed where unicode is not supported. -fn grapheme_is_ascii(grapheme: &str) -> bool { - grapheme.chars().all(|c| c.is_ascii()) -} - /// Replace emoji characters with similar but more widely supported ASCII /// characters fn unicode_to_ascii(c: char) -> char { diff --git a/crates/biome_fs/src/path.rs b/crates/biome_fs/src/path.rs index 6c6d83a55dbf..041b03986713 100644 --- a/crates/biome_fs/src/path.rs +++ b/crates/biome_fs/src/path.rs @@ -241,6 +241,7 @@ struct AliasPath { } impl AliasPath { + #[allow(dead_code)] pub fn new(name: impl Into) -> Self { Self { name: name.into(), @@ -248,20 +249,24 @@ impl AliasPath { } } + #[allow(dead_code)] pub fn add_prefix(&mut self, prefix: impl Into) { self.prefix.push(prefix.into()); } } +#[allow(dead_code)] pub struct Aliases { aliases: Vec, } impl Aliases { + #[allow(dead_code)] pub fn new() -> Self { Self { aliases: vec![] } } + #[allow(dead_code)] pub fn with_alias<'a>( mut self, name: impl Into, @@ -275,6 +280,7 @@ impl Aliases { self } + #[allow(dead_code)] pub fn get_paths_by_name(&self, name: &str) -> Option<&[PathBuf]> { self.aliases .iter() diff --git a/crates/biome_grit_patterns/src/grit_node.rs b/crates/biome_grit_patterns/src/grit_node.rs index 944568647947..b08170d5af1e 100644 --- a/crates/biome_grit_patterns/src/grit_node.rs +++ b/crates/biome_grit_patterns/src/grit_node.rs @@ -116,7 +116,7 @@ impl Iterator for AncestorIterator { type Item = GritNode; fn next(&mut self) -> Option { - let node = self.node.as_ref().cloned()?; + let node = self.node.clone()?; self.node = node.parent(); Some(node) } diff --git a/crates/biome_grit_patterns/src/grit_target_node.rs b/crates/biome_grit_patterns/src/grit_target_node.rs index 6af59685ae2e..eefdd9a28a24 100644 --- a/crates/biome_grit_patterns/src/grit_target_node.rs +++ b/crates/biome_grit_patterns/src/grit_target_node.rs @@ -386,7 +386,7 @@ impl<'a> Iterator for AncestorIterator<'a> { type Item = GritTargetNode<'a>; fn next(&mut self) -> Option { - let node = self.node.as_ref().cloned()?; + let node = self.node.clone()?; self.node = node.parent(); Some(node) } diff --git a/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs b/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs index 97f2bc393e98..e7f0390a094a 100644 --- a/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs +++ b/crates/biome_js_analyze/src/lint/complexity/no_excessive_cognitive_complexity.rs @@ -198,10 +198,7 @@ impl Visitor for CognitiveComplexityVisitor { impl CognitiveComplexityVisitor { fn on_enter(&mut self, node: &JsSyntaxNode) { let parent = self.stack.last(); - if parent - .map(|parent| parent.score == MAX_SCORE) - .unwrap_or_default() - { + if parent.is_some_and(|parent| parent.score == MAX_SCORE) { return; // No need for further processing if we're already at the max. } diff --git a/crates/biome_js_analyze/src/lint/nursery/use_consistent_curly_braces.rs b/crates/biome_js_analyze/src/lint/nursery/use_consistent_curly_braces.rs index 2587ca2d4c6f..a6f5c1a9156c 100644 --- a/crates/biome_js_analyze/src/lint/nursery/use_consistent_curly_braces.rs +++ b/crates/biome_js_analyze/src/lint/nursery/use_consistent_curly_braces.rs @@ -386,20 +386,17 @@ fn has_curly_braces(node: &AnyJsxCurlyQuery) -> bool { } fn contains_string_literal(node: &JsxExpressionAttributeValue) -> bool { - node.expression() - .map(|expr| { - matches!( - expr, - AnyJsExpression::AnyJsLiteralExpression( - AnyJsLiteralExpression::JsStringLiteralExpression(_) - ) + node.expression().is_ok_and(|expr| { + matches!( + expr, + AnyJsExpression::AnyJsLiteralExpression( + AnyJsLiteralExpression::JsStringLiteralExpression(_) ) - }) - .unwrap_or_default() + ) + }) } fn contains_jsx_tag(node: &JsxExpressionAttributeValue) -> bool { node.expression() - .map(|expr| matches!(expr, AnyJsExpression::JsxTagExpression(_))) - .unwrap_or_default() + .is_ok_and(|expr| matches!(expr, AnyJsExpression::JsxTagExpression(_))) } diff --git a/crates/biome_js_analyze/src/services/manifest.rs b/crates/biome_js_analyze/src/services/manifest.rs index 6ffd45c726ed..c471d8da1064 100644 --- a/crates/biome_js_analyze/src/services/manifest.rs +++ b/crates/biome_js_analyze/src/services/manifest.rs @@ -24,32 +24,28 @@ impl ManifestServices { self.manifest .as_ref() .as_ref() - .map(|pkg| pkg.dependencies.contains(specifier)) - .unwrap_or_default() + .is_some_and(|pkg| pkg.dependencies.contains(specifier)) } pub(crate) fn is_dev_dependency(&self, specifier: &str) -> bool { self.manifest .as_ref() .as_ref() - .map(|pkg| pkg.dev_dependencies.contains(specifier)) - .unwrap_or_default() + .is_some_and(|pkg| pkg.dev_dependencies.contains(specifier)) } pub(crate) fn is_peer_dependency(&self, specifier: &str) -> bool { self.manifest .as_ref() .as_ref() - .map(|pkg| pkg.peer_dependencies.contains(specifier)) - .unwrap_or_default() + .is_some_and(|pkg| pkg.peer_dependencies.contains(specifier)) } pub(crate) fn is_optional_dependency(&self, specifier: &str) -> bool { self.manifest .as_ref() .as_ref() - .map(|pkg| pkg.optional_dependencies.contains(specifier)) - .unwrap_or_default() + .is_some_and(|pkg| pkg.optional_dependencies.contains(specifier)) } } diff --git a/crates/biome_js_analyze/src/suppression_action.rs b/crates/biome_js_analyze/src/suppression_action.rs index d2d0b8e2571e..b86f20ee5532 100644 --- a/crates/biome_js_analyze/src/suppression_action.rs +++ b/crates/biome_js_analyze/src/suppression_action.rs @@ -65,17 +65,14 @@ impl SuppressionAction for JsSuppressionAction { // There are some tokens that might contains newlines in their tokens, only // few nodes matches this criteria. If the token is inside one of those nodes, // then we check its content. - let nodes_that_might_contain_newlines = current_token - .parent() - .map(|node| { - matches!( - node.kind(), - JsSyntaxKind::JSX_TEXT - | JsSyntaxKind::JS_STRING_LITERAL - | JsSyntaxKind::TEMPLATE_CHUNK - ) - }) - .unwrap_or_default(); + let nodes_that_might_contain_newlines = current_token.parent().is_some_and(|node| { + matches!( + node.kind(), + JsSyntaxKind::JSX_TEXT + | JsSyntaxKind::JS_STRING_LITERAL + | JsSyntaxKind::TEMPLATE_CHUNK + ) + }); if current_token .trailing_trivia() .pieces() @@ -154,8 +151,7 @@ impl SuppressionAction for JsSuppressionAction { // quick check is the element is inside a list if current_jsx_element .parent() - .map(|p| JsxChildList::can_cast(p.kind())) - .unwrap_or_default() + .is_some_and(|p| JsxChildList::can_cast(p.kind())) { let jsx_comment = jsx_expression_child( token(T!['{']).with_trailing_trivia([( diff --git a/crates/biome_js_parser/src/syntax/expr.rs b/crates/biome_js_parser/src/syntax/expr.rs index 4efeaa5be9b1..49ff6937292b 100644 --- a/crates/biome_js_parser/src/syntax/expr.rs +++ b/crates/biome_js_parser/src/syntax/expr.rs @@ -2162,7 +2162,7 @@ pub(super) fn parse_unary_expr(p: &mut JsParser, context: ExpressionContext) -> let mut rewriter = DeleteExpressionRewriter::default(); rewrite_events(&mut rewriter, checkpoint, p); - rewriter.result.take().map(|res| { + rewriter.result.take().inspect(|_| { if StrictMode.is_supported(p) { if let Some(range) = rewriter.exited_ident_expr { kind = JS_BOGUS_EXPRESSION; @@ -2180,8 +2180,6 @@ pub(super) fn parse_unary_expr(p: &mut JsParser, context: ExpressionContext) -> range, )); } - - res }) } else { parse_unary_expr(p, context).ok() diff --git a/crates/biome_js_parser/src/syntax/typescript/types.rs b/crates/biome_js_parser/src/syntax/typescript/types.rs index 9e4bcd9e895f..c517023aafcd 100644 --- a/crates/biome_js_parser/src/syntax/typescript/types.rs +++ b/crates/biome_js_parser/src/syntax/typescript/types.rs @@ -83,10 +83,6 @@ impl TypeContext { pub const TYPE_OR_INTERFACE_DECLARATION: Self = Self(make_bitflags!(ContextFlag::{TypeOrInterfaceDeclaration})); - pub const fn empty() -> Self { - Self(BitFlags::EMPTY) - } - pub fn contains(&self, other: impl Into) -> bool { self.0.contains(other.into().0) } diff --git a/crates/biome_js_syntax/src/expr_ext.rs b/crates/biome_js_syntax/src/expr_ext.rs index 7654cfcdea7e..995a533e61cd 100644 --- a/crates/biome_js_syntax/src/expr_ext.rs +++ b/crates/biome_js_syntax/src/expr_ext.rs @@ -85,8 +85,7 @@ impl JsReferenceIdentifier { /// ``` pub fn has_name(&self, name: &str) -> bool { self.value_token() - .map(|token| token.text_trimmed() == name) - .unwrap_or_default() + .is_ok_and(|token| token.text_trimmed() == name) } pub fn name(&self) -> SyntaxResult { diff --git a/crates/biome_rowan/src/ast/mod.rs b/crates/biome_rowan/src/ast/mod.rs index abff787082ef..ac760c0109a9 100644 --- a/crates/biome_rowan/src/ast/mod.rs +++ b/crates/biome_rowan/src/ast/mod.rs @@ -29,7 +29,7 @@ pub use mutation::{AstNodeExt, AstNodeListExt, AstSeparatedListExt}; /// bitfield here being twice as large as it needs to cover all nodes as well /// as all token kinds #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct SyntaxKindSet([u128; 4], PhantomData); +pub struct SyntaxKindSet([u128; 4], PhantomData); impl SyntaxKindSet where diff --git a/crates/biome_rowan/src/cursor/node.rs b/crates/biome_rowan/src/cursor/node.rs index 2f97dafe7fa0..72e9105cb024 100644 --- a/crates/biome_rowan/src/cursor/node.rs +++ b/crates/biome_rowan/src/cursor/node.rs @@ -476,9 +476,8 @@ impl SyntaxNodeChildren { impl Iterator for SyntaxNodeChildren { type Item = SyntaxNode; fn next(&mut self) -> Option { - self.next.take().map(|next| { + self.next.take().inspect(|next| { self.next = next.next_sibling(); - next }) } } @@ -501,9 +500,8 @@ impl SyntaxElementChildren { impl Iterator for SyntaxElementChildren { type Item = SyntaxElement; fn next(&mut self) -> Option { - self.next.take().map(|next| { + self.next.take().inspect(|next| { self.next = next.next_sibling_or_token(); - next }) } } diff --git a/crates/biome_service/src/file_handlers/javascript.rs b/crates/biome_service/src/file_handlers/javascript.rs index d093b063d301..b5d694b3194c 100644 --- a/crates/biome_service/src/file_handlers/javascript.rs +++ b/crates/biome_service/src/file_handlers/javascript.rs @@ -323,15 +323,13 @@ fn parse( ) -> ParseResult { let mut options = JsParserOptions { grit_metavariables: false, - parse_class_parameter_decorators: settings - .map(|settings| { - settings - .languages - .javascript - .parser - .parse_class_parameter_decorators - }) - .unwrap_or_default(), + parse_class_parameter_decorators: settings.is_some_and(|settings| { + settings + .languages + .javascript + .parser + .parse_class_parameter_decorators + }), }; if let Some(settings) = settings { options = settings diff --git a/crates/biome_service/src/file_handlers/mod.rs b/crates/biome_service/src/file_handlers/mod.rs index 2da2abb62147..76ae2cb2e158 100644 --- a/crates/biome_service/src/file_handlers/mod.rs +++ b/crates/biome_service/src/file_handlers/mod.rs @@ -1006,8 +1006,7 @@ impl<'a, 'b> AssistsVisitor<'a, 'b> { let organize_imports_enabled = self .settings - .map(|settings| settings.organize_imports.enabled) - .unwrap_or_default(); + .is_some_and(|settings| settings.organize_imports.enabled); if organize_imports_enabled && self.import_sorting.match_rule::() { self.enabled_rules.push(self.import_sorting); return; diff --git a/crates/biome_service/src/workspace.rs b/crates/biome_service/src/workspace.rs index 5416b5faad7f..2b6fcdc45036 100644 --- a/crates/biome_service/src/workspace.rs +++ b/crates/biome_service/src/workspace.rs @@ -255,8 +255,7 @@ impl FileFeaturesResult { fn supports_for(&self, feature: &FeatureKind) -> bool { self.features_supported .get(feature) - .map(|support_kind| matches!(support_kind, SupportKind::Supported)) - .unwrap_or_default() + .is_some_and(|support_kind| matches!(support_kind, SupportKind::Supported)) } pub fn supports_lint(&self) -> bool { diff --git a/crates/biome_service/src/workspace/server.rs b/crates/biome_service/src/workspace/server.rs index b3f70d5fa443..c8aa6ae6412d 100644 --- a/crates/biome_service/src/workspace/server.rs +++ b/crates/biome_service/src/workspace/server.rs @@ -311,24 +311,19 @@ impl WorkspaceServer { || settings.files.included_files.matches_path(path); !is_included || settings.files.ignored_files.matches_path(path) - || settings - .files - .git_ignore - .as_ref() - .map(|ignore| { - // `matched_path_or_any_parents` panics if `source` is not under the gitignore root. - // This checks excludes absolute paths that are not a prefix of the base root. - if !path.has_root() || path.starts_with(ignore.path()) { - // Because Biome passes a list of paths, - // we use `matched_path_or_any_parents` instead of `matched`. - ignore - .matched_path_or_any_parents(path, path.is_dir()) - .is_ignore() - } else { - false - } - }) - .unwrap_or_default() + || settings.files.git_ignore.as_ref().is_some_and(|ignore| { + // `matched_path_or_any_parents` panics if `source` is not under the gitignore root. + // This checks excludes absolute paths that are not a prefix of the base root. + if !path.has_root() || path.starts_with(ignore.path()) { + // Because Biome passes a list of paths, + // we use `matched_path_or_any_parents` instead of `matched`. + ignore + .matched_path_or_any_parents(path, path.is_dir()) + .is_ignore() + } else { + false + } + }) } /// Check whether a file is ignored in the feature `ignore`/`include` diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 51592e4981e7..7d0bc1fd6683 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,4 +2,4 @@ # The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy. # https://rust-lang.github.io/rustup/concepts/profiles.html profile = "default" -channel = "1.80.0" +channel = "1.81.0" diff --git a/xtask/coverage/src/symbols/msts.rs b/xtask/coverage/src/symbols/msts.rs index cf6aac2b76f8..6c42338238e5 100644 --- a/xtask/coverage/src/symbols/msts.rs +++ b/xtask/coverage/src/symbols/msts.rs @@ -242,12 +242,16 @@ struct SymbolsFile { } /// This function parses lines like: +/// +/// ```ignore /// >Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0)) /// | | | | \--+---> line and column ofthe first char of the leading trivia where the declaration /// | | | \--> File where the declaration of this symbol is /// | | \--> States that this Symbol is a declaration /// | \--> Complete Path of the Symbol /// \--> text of the symbol +/// ``` +/// /// To understand how the Typescript codebase generate this line /// see xtask\coverage\Typescript\src\harness\typeWriter.ts fn parse_symbol(input: &str) -> Option { diff --git a/xtask/rules_check/src/lib.rs b/xtask/rules_check/src/lib.rs index f285d9deb2af..23cf017ce3b8 100644 --- a/xtask/rules_check/src/lib.rs +++ b/xtask/rules_check/src/lib.rs @@ -142,7 +142,7 @@ impl FromStr for CodeBlockTest { // This is based on the parsing logic for code block languages in `rustdoc`: // https://github.com/rust-lang/rust/blob/6ac8adad1f7d733b5b97d1df4e7f96e73a46db42/src/librustdoc/html/markdown.rs#L873 let tokens = input - .split(|c| c == ',' || c == ' ' || c == '\t') + .split([',', ' ', '\t']) .map(str::trim) .filter(|token| !token.is_empty());