Skip to content

Commit 9b2d5db

Browse files
authored
chore: switch to Rustfmt 2024 style edition (biomejs#5236)
1 parent bf675cf commit 9b2d5db

File tree

1,076 files changed

+9969
-2511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,076 files changed

+9969
-2511
lines changed

crates/biome_analyze/src/categories.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use enumflags2::{bitflags, BitFlags};
1+
use enumflags2::{BitFlags, bitflags};
22
use std::borrow::Cow;
33
use std::fmt::{Display, Formatter};
44

crates/biome_analyze/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::options::{JsxRuntime, PreferredQuote};
2-
use crate::{registry::RuleRoot, FromServices, Queryable, Rule, RuleKey, ServiceBag};
2+
use crate::{FromServices, Queryable, Rule, RuleKey, ServiceBag, registry::RuleRoot};
33
use crate::{GroupCategory, RuleCategory, RuleGroup, RuleMetadata};
44
use biome_diagnostics::{Error, Result};
55
use camino::Utf8Path;

crates/biome_analyze/src/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use biome_console::{markup, MarkupBuf};
1+
use biome_console::{MarkupBuf, markup};
22
use biome_diagnostics::{
3-
advice::CodeSuggestionAdvice, category, Advices, Category, Diagnostic, DiagnosticExt,
4-
DiagnosticTags, Error, Location, LogCategory, MessageAndDescription, Severity, Visit,
3+
Advices, Category, Diagnostic, DiagnosticExt, DiagnosticTags, Error, Location, LogCategory,
4+
MessageAndDescription, Severity, Visit, advice::CodeSuggestionAdvice, category,
55
};
66
use biome_rowan::TextRange;
77
use std::borrow::Cow;

crates/biome_analyze/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ pub use biome_diagnostics::category_concat;
3030
pub use crate::analyzer_plugin::{AnalyzerPlugin, AnalyzerPluginSlice, AnalyzerPluginVec};
3131
pub use crate::categories::{
3232
ActionCategory, OtherActionCategory, RefactorKind, RuleCategories, RuleCategoriesBuilder,
33-
RuleCategory, SourceActionKind, SUPPRESSION_INLINE_ACTION_CATEGORY,
34-
SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY,
33+
RuleCategory, SUPPRESSION_INLINE_ACTION_CATEGORY, SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY,
34+
SourceActionKind,
3535
};
3636
pub use crate::diagnostics::{AnalyzerDiagnostic, AnalyzerSuppressionDiagnostic, RuleError};
3737
pub use crate::matcher::{InspectMatcher, MatchQueryParams, QueryMatcher, RuleKey, SignalEntry};
@@ -52,7 +52,7 @@ pub use crate::signals::{
5252
use crate::suppressions::Suppressions;
5353
pub use crate::syntax::{Ast, SyntaxVisitor};
5454
pub use crate::visitor::{NodeVisitor, Visitor, VisitorContext, VisitorFinishContext};
55-
use biome_diagnostics::{category, Diagnostic, DiagnosticExt};
55+
use biome_diagnostics::{Diagnostic, DiagnosticExt, category};
5656
use biome_rowan::{
5757
AstNode, BatchMutation, Direction, Language, SyntaxElement, SyntaxToken, TextRange, TextSize,
5858
TokenAtOffset, TriviaPieceKind, WalkEvent,
@@ -280,9 +280,9 @@ where
280280
)
281281
} else {
282282
AnalyzerSuppressionDiagnostic::new(
283-
category!("suppressions/unused"),
284-
suppression.comment_span,
285-
"Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.",
283+
category!("suppressions/unused"),
284+
suppression.comment_span,
285+
"Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.",
286286
)
287287
}
288288
});

crates/biome_analyze/src/matcher.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,16 @@ where
200200
mod tests {
201201
use super::MatchQueryParams;
202202
use crate::{
203-
signals::DiagnosticSignal, Analyzer, AnalyzerContext, AnalyzerSignal, ApplySuppression,
204-
ControlFlow, MetadataRegistry, Never, Phases, QueryMatcher, RuleKey, ServiceBag,
205-
SignalEntry, SuppressionAction, SyntaxVisitor,
203+
Analyzer, AnalyzerContext, AnalyzerSignal, ApplySuppression, ControlFlow, MetadataRegistry,
204+
Never, Phases, QueryMatcher, RuleKey, ServiceBag, SignalEntry, SuppressionAction,
205+
SyntaxVisitor, signals::DiagnosticSignal,
206206
};
207207
use crate::{AnalyzerOptions, AnalyzerSuppression};
208-
use biome_diagnostics::{category, DiagnosticExt};
209208
use biome_diagnostics::{Diagnostic, Severity};
209+
use biome_diagnostics::{DiagnosticExt, category};
210210
use biome_rowan::{
211-
raw_language::{RawLanguage, RawLanguageKind, RawLanguageRoot, RawSyntaxTreeBuilder},
212211
AstNode, BatchMutation, SyntaxNode, SyntaxToken, TextRange, TextSize, TriviaPiece,
212+
raw_language::{RawLanguage, RawLanguageKind, RawLanguageRoot, RawSyntaxTreeBuilder},
213213
};
214214
use std::convert::Infallible;
215215

crates/biome_analyze/src/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::any::TypeId;
22

33
use biome_rowan::{Language, SyntaxKindSet, TextRange};
44

5-
use crate::{registry::Phase, services::FromServices, Phases, ServiceBag, Visitor};
5+
use crate::{Phases, ServiceBag, Visitor, registry::Phase, services::FromServices};
66

77
/// Trait implemented for types that lint rules can query in order to emit diagnostics or code actions.
88
pub trait Queryable: Sized {

crates/biome_analyze/src/registry.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::{
2+
AddVisitor, AnalysisFilter, GroupCategory, QueryMatcher, Rule, RuleGroup, RuleKey,
3+
RuleMetadata, ServiceBag, SignalEntry, Visitor,
24
context::RuleContext,
35
matcher::{GroupKey, MatchQueryParams},
46
query::{QueryKey, Queryable},
57
signals::RuleSignal,
6-
AddVisitor, AnalysisFilter, GroupCategory, QueryMatcher, Rule, RuleGroup, RuleKey,
7-
RuleMetadata, ServiceBag, SignalEntry, Visitor,
88
};
99
use biome_diagnostics::Error;
1010
use biome_rowan::{AstNode, Language, RawSyntaxKind, SyntaxKind, SyntaxNode};
@@ -179,7 +179,9 @@ impl<L: Language + Default + 'static> RegistryVisitor<L> for RuleRegistryBuilder
179179
.entry(TypeId::of::<SyntaxNode<L>>())
180180
.or_insert_with(|| TypeRules::SyntaxRules { rules: Vec::new() })
181181
else {
182-
unreachable!("the SyntaxNode type has already been registered as a TypeRules instead of a SyntaxRules, this is generally caused by an implementation of `Queryable::key` returning a `QueryKey::TypeId` with the type ID of `SyntaxNode`")
182+
unreachable!(
183+
"the SyntaxNode type has already been registered as a TypeRules instead of a SyntaxRules, this is generally caused by an implementation of `Queryable::key` returning a `QueryKey::TypeId` with the type ID of `SyntaxNode`"
184+
)
183185
};
184186

185187
// Iterate on all the SyntaxKind variants this node can match
@@ -207,7 +209,9 @@ impl<L: Language + Default + 'static> RegistryVisitor<L> for RuleRegistryBuilder
207209
.entry(key)
208210
.or_insert_with(|| TypeRules::TypeRules { rules: Vec::new() })
209211
else {
210-
unreachable!("the query type has already been registered as a SyntaxRules instead of a TypeRules, this is generally caused by an implementation of `Queryable::key` returning a `QueryKey::TypeId` with the type ID of `SyntaxNode`")
212+
unreachable!(
213+
"the query type has already been registered as a SyntaxRules instead of a TypeRules, this is generally caused by an implementation of `Queryable::key` returning a `QueryKey::TypeId` with the type ID of `SyntaxNode`"
214+
)
211215
};
212216

213217
rules.push(rule);

crates/biome_analyze/src/rule.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
Phase, Phases, Queryable, SourceActionKind, SuppressionAction, SuppressionCommentEmitterPayload,
66
};
77
use biome_console::fmt::{Display, Formatter};
8-
use biome_console::{markup, MarkupBuf, Padding};
8+
use biome_console::{MarkupBuf, Padding, markup};
99
use biome_diagnostics::advice::CodeSuggestionAdvice;
1010
use biome_diagnostics::location::AsSpan;
1111
use biome_diagnostics::{

crates/biome_analyze/src/signals.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use crate::categories::{
22
SUPPRESSION_INLINE_ACTION_CATEGORY, SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY,
33
};
44
use crate::{
5+
AnalyzerDiagnostic, AnalyzerOptions, OtherActionCategory, Queryable, RuleGroup, ServiceBag,
6+
SuppressionAction,
57
categories::ActionCategory,
68
context::RuleContext,
79
registry::{RuleLanguage, RuleRoot},
810
rule::Rule,
9-
AnalyzerDiagnostic, AnalyzerOptions, OtherActionCategory, Queryable, RuleGroup, ServiceBag,
10-
SuppressionAction,
1111
};
1212
use biome_console::MarkupBuf;
13-
use biome_diagnostics::{advice::CodeSuggestionAdvice, Applicability, CodeSuggestion, Error};
13+
use biome_diagnostics::{Applicability, CodeSuggestion, Error, advice::CodeSuggestionAdvice};
1414
use biome_rowan::{BatchMutation, Language};
1515
use std::iter::FusedIterator;
1616
use std::marker::PhantomData;

crates/biome_analyze/src/syntax.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use biome_rowan::{AstNode, Language, SyntaxNode, WalkEvent};
22

33
use crate::{
4-
registry::NodeLanguage, AddVisitor, Phases, QueryKey, QueryMatch, Queryable, ServiceBag,
5-
Visitor, VisitorContext,
4+
AddVisitor, Phases, QueryKey, QueryMatch, Queryable, ServiceBag, Visitor, VisitorContext,
5+
registry::NodeLanguage,
66
};
77

88
/// Query type usable by lint rules to match on specific [AstNode] types
@@ -93,15 +93,15 @@ impl<L: Language + 'static> Visitor for SyntaxVisitor<L> {
9393
#[cfg(test)]
9494
mod tests {
9595
use biome_rowan::{
96-
raw_language::{RawLanguage, RawLanguageKind, RawLanguageRoot, RawSyntaxTreeBuilder},
9796
AstNode, BatchMutation, SyntaxNode, SyntaxToken,
97+
raw_language::{RawLanguage, RawLanguageKind, RawLanguageRoot, RawSyntaxTreeBuilder},
9898
};
9999
use std::convert::Infallible;
100100

101101
use crate::{
102-
matcher::MatchQueryParams, registry::Phases, Analyzer, AnalyzerContext, AnalyzerOptions,
103-
AnalyzerSignal, ApplySuppression, ControlFlow, MetadataRegistry, Never, QueryMatcher,
104-
ServiceBag, SuppressionAction, SyntaxVisitor,
102+
Analyzer, AnalyzerContext, AnalyzerOptions, AnalyzerSignal, ApplySuppression, ControlFlow,
103+
MetadataRegistry, Never, QueryMatcher, ServiceBag, SuppressionAction, SyntaxVisitor,
104+
matcher::MatchQueryParams, registry::Phases,
105105
};
106106

107107
#[derive(Default)]

crates/biome_analyze/src/visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
2-
matcher::{MatchQueryParams, Query},
3-
registry::{NodeLanguage, Phases},
42
AnalyzerOptions, LanguageRoot, QueryMatch, QueryMatcher, ServiceBag, SignalEntry,
53
SuppressionAction,
4+
matcher::{MatchQueryParams, Query},
5+
registry::{NodeLanguage, Phases},
66
};
77
use biome_rowan::{AstNode, Language, SyntaxNode, TextRange, WalkEvent};
88
use std::collections::BinaryHeap;

crates/biome_cli/src/changed.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ pub(crate) fn get_changed_files(
1717
(Some(since), Some(_)) => since,
1818
(Some(since), None) => since,
1919
(None, Some(branch)) => branch,
20-
(None, None) => return Err(CliDiagnostic::incompatible_end_configuration("The `--changed` flag was set, but Biome couldn't determine the base to compare against. Either set configuration.vcs.defaultBranch or use the --since argument.")),
20+
(None, None) => {
21+
return Err(CliDiagnostic::incompatible_end_configuration(
22+
"The `--changed` flag was set, but Biome couldn't determine the base to compare against. Either set configuration.vcs.defaultBranch or use the --since argument.",
23+
));
24+
}
2125
};
2226

2327
let changed_files = fs.get_changed_files(base)?;

crates/biome_cli/src/cli_options.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::logging::LoggingKind;
21
use crate::LoggingLevel;
2+
use crate::logging::LoggingKind;
33
use biome_configuration::ConfigurationPathHint;
44
use biome_diagnostics::Severity;
55
use bpaf::Bpaf;
@@ -216,7 +216,10 @@ impl FromStr for MaxDiagnostics {
216216
if let Ok(value) = s.parse::<u32>() {
217217
Ok(MaxDiagnostics::Limit(value))
218218
} else {
219-
Err(format!("Invalid value provided. Provide 'none' to lift the limit, or a number between 0 and {}.", u32::MAX))
219+
Err(format!(
220+
"Invalid value provided. Provide 'none' to lift the limit, or a number between 0 and {}.",
221+
u32::MAX
222+
))
220223
}
221224
}
222225
}

crates/biome_cli/src/commands/check.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use super::{determine_fix_file_mode, FixFileModeOptions, LoadEditorConfig};
1+
use super::{FixFileModeOptions, LoadEditorConfig, determine_fix_file_mode};
22
use crate::cli_options::CliOptions;
3-
use crate::commands::{get_files_to_process_with_cli_options, CommandRunner};
3+
use crate::commands::{CommandRunner, get_files_to_process_with_cli_options};
44
use crate::{CliDiagnostic, Execution, TraversalMode};
5-
use biome_configuration::analyzer::assist::{AssistConfiguration, AssistEnabled};
65
use biome_configuration::analyzer::LinterEnabled;
6+
use biome_configuration::analyzer::assist::{AssistConfiguration, AssistEnabled};
77
use biome_configuration::formatter::FormatterEnabled;
88
use biome_configuration::{Configuration, FormatterConfiguration, LinterConfiguration};
99
use biome_console::Console;
1010
use biome_deserialize::Merge;
1111
use biome_fs::FileSystem;
1212
use biome_service::projects::ProjectKey;
13-
use biome_service::{configuration::LoadedConfiguration, Workspace, WorkspaceError};
13+
use biome_service::{Workspace, WorkspaceError, configuration::LoadedConfiguration};
1414
use std::ffi::OsString;
1515

1616
pub(crate) struct CheckCommandPayload {

crates/biome_cli/src/commands/ci.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::changed::get_changed_files;
22
use crate::cli_options::CliOptions;
33
use crate::commands::{CommandRunner, LoadEditorConfig};
44
use crate::{CliDiagnostic, Execution};
5-
use biome_configuration::analyzer::assist::{AssistConfiguration, AssistEnabled};
65
use biome_configuration::analyzer::LinterEnabled;
6+
use biome_configuration::analyzer::assist::{AssistConfiguration, AssistEnabled};
77
use biome_configuration::formatter::FormatterEnabled;
88
use biome_configuration::{Configuration, FormatterConfiguration, LinterConfiguration};
99
use biome_console::Console;
@@ -126,7 +126,9 @@ impl CommandRunner for CiCommandPayload {
126126
&& self.linter_enabled.is_some_and(|v| !v.value())
127127
&& self.assist_enabled.is_some_and(|v| !v.value())
128128
{
129-
return Err(CliDiagnostic::incompatible_end_configuration("Formatter, linter and assist are disabled, can't perform the command. At least one feature needs to be enabled. This is probably and error."));
129+
return Err(CliDiagnostic::incompatible_end_configuration(
130+
"Formatter, linter and assist are disabled, can't perform the command. At least one feature needs to be enabled. This is probably and error.",
131+
));
130132
}
131133
if self.since.is_some() && !self.changed {
132134
return Err(CliDiagnostic::incompatible_arguments("since", "changed"));

crates/biome_cli/src/commands/daemon.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
use crate::{
2-
open_transport,
2+
CliDiagnostic, CliSession, open_transport,
33
service::{self, ensure_daemon, open_socket, run_daemon},
4-
CliDiagnostic, CliSession,
54
};
6-
use biome_console::{markup, ConsoleExt};
5+
use biome_console::{ConsoleExt, markup};
76
use biome_fs::OsFileSystem;
87
use biome_lsp::ServerFactory;
9-
use biome_service::{workspace::WorkspaceClient, TransportError, WorkspaceError, WorkspaceWatcher};
8+
use biome_service::{TransportError, WorkspaceError, WorkspaceWatcher, workspace::WorkspaceClient};
109
use camino::{Utf8Path, Utf8PathBuf};
1110
use std::{env, fs};
1211
use tokio::io;
1312
use tokio::runtime::Runtime;
1413
use tracing::subscriber::Interest;
15-
use tracing::{debug_span, metadata::LevelFilter, Instrument, Metadata};
14+
use tracing::{Instrument, Metadata, debug_span, metadata::LevelFilter};
1615
use tracing_appender::rolling::Rotation;
1716
use tracing_subscriber::{
17+
Layer,
1818
layer::{Context, Filter},
1919
prelude::*,
20-
registry, Layer,
20+
registry,
2121
};
2222
use tracing_tree::HierarchicalLayer;
2323

crates/biome_cli/src/commands/explain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use biome_analyze::RuleMetadata;
2-
use biome_console::{markup, ConsoleExt};
2+
use biome_console::{ConsoleExt, markup};
33
use biome_flags::biome_env;
44
use biome_service::documentation::Doc;
55

crates/biome_cli/src/commands/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::cli_options::CliOptions;
2-
use crate::commands::{get_files_to_process_with_cli_options, CommandRunner, LoadEditorConfig};
2+
use crate::commands::{CommandRunner, LoadEditorConfig, get_files_to_process_with_cli_options};
33
use crate::{CliDiagnostic, Execution, TraversalMode};
44
use biome_configuration::css::CssFormatterConfiguration;
55
use biome_configuration::graphql::GraphqlFormatterConfiguration;

crates/biome_cli/src/commands/init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{CliDiagnostic, CliSession};
22
use biome_configuration::Configuration;
3-
use biome_console::{markup, ConsoleExt};
3+
use biome_console::{ConsoleExt, markup};
44
use biome_fs::ConfigName;
55
use biome_service::configuration::create_config;
66

crates/biome_cli/src/commands/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use super::{determine_fix_file_mode, FixFileModeOptions};
1+
use super::{FixFileModeOptions, determine_fix_file_mode};
22
use crate::cli_options::CliOptions;
3-
use crate::commands::{get_files_to_process_with_cli_options, CommandRunner};
3+
use crate::commands::{CommandRunner, get_files_to_process_with_cli_options};
44
use crate::{CliDiagnostic, Execution, TraversalMode};
55
use biome_configuration::analyzer::RuleSelector;
66
use biome_configuration::css::CssLinterConfiguration;

crates/biome_cli/src/commands/migrate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use super::{
2-
check_fix_incompatible_arguments, CommandRunner, FixFileModeOptions, MigrateSubCommand,
2+
CommandRunner, FixFileModeOptions, MigrateSubCommand, check_fix_incompatible_arguments,
33
};
4+
use crate::CliDiagnostic;
45
use crate::cli_options::CliOptions;
56
use crate::diagnostics::MigrationDiagnostic;
67
use crate::execute::{Execution, TraversalMode};
7-
use crate::CliDiagnostic;
88
use biome_configuration::Configuration;
9-
use biome_console::{markup, Console, ConsoleExt};
9+
use biome_console::{Console, ConsoleExt, markup};
1010
use biome_fs::FileSystem;
1111
use biome_service::configuration::LoadedConfiguration;
1212
use biome_service::projects::ProjectKey;

0 commit comments

Comments
 (0)