Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade rust v1.84.0 #4912

Merged
merged 5 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ allow_attributes = "deny"
cargo_common_metadata = "allow"
empty_docs = "allow" # there are some false positives inside biome_wasm
multiple_crate_versions = "allow"
needless_lifetimes = "allow"
unnecessary_map_or = "allow"

# pedantic
assigning_clones = "warn"
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ where
}
}

impl<'a, R> Deref for RuleContext<'a, R>
impl<R> Deref for RuleContext<'_, R>
where
R: Rule,
{
Expand Down
10 changes: 5 additions & 5 deletions crates/biome_analyze/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ struct PhaseRunner<'analyzer, 'phase, L: Language, Matcher, Break, Diag> {
suppressions: &'phase mut Suppressions<'analyzer>,
}

impl<'a, 'phase, L, Matcher, Break, Diag> PhaseRunner<'a, 'phase, L, Matcher, Break, Diag>
impl<L, Matcher, Break, Diag> PhaseRunner<'_, '_, L, Matcher, Break, Diag>
where
L: Language,
Matcher: QueryMatcher<L>,
Expand Down Expand Up @@ -708,7 +708,7 @@ pub fn to_analyzer_suppressions(
result
}

impl<'a> AnalyzerSuppression<'a> {
impl AnalyzerSuppression<'_> {
pub const fn is_top_level(&self) -> bool {
matches!(self.variant, AnalyzerSuppressionVariant::TopLevel)
}
Expand Down Expand Up @@ -776,13 +776,13 @@ impl<'a> RuleFilter<'a> {
}
}

impl<'a> Debug for RuleFilter<'a> {
impl Debug for RuleFilter<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
Display::fmt(self, f)
}
}

impl<'a> Display for RuleFilter<'a> {
impl Display for RuleFilter<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
RuleFilter::Group(group) => {
Expand All @@ -795,7 +795,7 @@ impl<'a> Display for RuleFilter<'a> {
}
}

impl<'a> biome_console::fmt::Display for RuleFilter<'a> {
impl biome_console::fmt::Display for RuleFilter<'_> {
fn fmt(&self, fmt: &mut biome_console::fmt::Formatter) -> std::io::Result<()> {
match self {
RuleFilter::Group(group) => {
Expand Down
8 changes: 4 additions & 4 deletions crates/biome_analyze/src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,21 @@ pub struct SignalEntry<'phase, L: Language> {
}

// SignalEntry is ordered based on the starting point of its `text_range`
impl<'phase, L: Language> Ord for SignalEntry<'phase, L> {
impl<L: Language> Ord for SignalEntry<'_, L> {
fn cmp(&self, other: &Self) -> Ordering {
other.text_range.start().cmp(&self.text_range.start())
}
}

impl<'phase, L: Language> PartialOrd for SignalEntry<'phase, L> {
impl<L: Language> PartialOrd for SignalEntry<'_, L> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

impl<'phase, L: Language> Eq for SignalEntry<'phase, L> {}
impl<L: Language> Eq for SignalEntry<'_, L> {}

impl<'phase, L: Language> PartialEq for SignalEntry<'phase, L> {
impl<L: Language> PartialEq for SignalEntry<'_, L> {
fn eq(&self, other: &Self) -> bool {
self.text_range.start() == other.text_range.start()
}
Expand Down
7 changes: 2 additions & 5 deletions crates/biome_analyze/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl<L: Language + Default> RegistryRule<L> {
let preferred_quote = params.options.preferred_quote();
let jsx_runtime = params.options.jsx_runtime();
let options = params.options.rule_options::<R>().unwrap_or_default();
let ctx = match RuleContext::new(
let ctx = RuleContext::new(
&query_result,
params.root,
params.services,
Expand All @@ -410,10 +410,7 @@ impl<L: Language + Default> RegistryRule<L> {
&options,
preferred_quote,
jsx_runtime,
) {
Ok(ctx) => ctx,
Err(error) => return Err(error),
};
)?;

for result in R::run(&ctx) {
let text_range =
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ where
}
}

impl<'bag, R> AnalyzerSignal<RuleLanguage<R>> for RuleSignal<'bag, R>
impl<R> AnalyzerSignal<RuleLanguage<R>> for RuleSignal<'_, R>
where
R: Rule<Options: Default> + 'static,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct VisitorContext<'phase, 'query, L: Language> {
pub options: &'phase AnalyzerOptions,
}

impl<'phase, 'query, L: Language> VisitorContext<'phase, 'query, L> {
impl<L: Language> VisitorContext<'_, '_, L> {
pub fn match_query<T: QueryMatch>(&mut self, query: T) {
self.query_matcher.match_query(MatchQueryParams {
phase: self.phase,
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_cli/src/commands/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ impl CommandRunner for FormatCommandPayload {
let mut configuration = fs_configuration;

// merge formatter options
if !configuration
if configuration
.formatter
.as_ref()
.is_some_and(|f| !f.is_enabled())
.is_none_or(|f| f.is_enabled())
{
let formatter = configuration.formatter.get_or_insert_with(Default::default);
if let Some(formatter_configuration) = self.formatter_configuration.clone() {
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/execute/migrate/eslint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::node;
/// Note that we don't need to deserialise every existing rule option.
/// We only need to deserialise options that have equivalent biome options.
/// This greatly reduces the amount of work involved.

///
/// ESLint flat configuration filenames.
///
/// See https://eslint.org/docs/latest/use/configure/configuration-files-new
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_cli/src/execute/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ pub(crate) struct TraversalOptions<'ctx, 'app> {
pub(crate) evaluated_paths: RwLock<BTreeSet<BiomePath>>,
}

impl<'ctx, 'app> TraversalOptions<'ctx, 'app> {
impl TraversalOptions<'_, '_> {
pub(crate) fn increment_changed(&self, path: &BiomePath) {
self.changed.fetch_add(1, Ordering::Relaxed);
self.evaluated_paths
Expand Down Expand Up @@ -564,7 +564,7 @@ impl<'ctx, 'app> TraversalOptions<'ctx, 'app> {
}
}

impl<'ctx, 'app> TraversalContext for TraversalOptions<'ctx, 'app> {
impl TraversalContext for TraversalOptions<'_, '_> {
fn interner(&self) -> &PathInterner {
&self.interner
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_cli/src/reporter/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Reporter for GithubReporter {
}
pub(crate) struct GithubReporterVisitor<'a>(pub(crate) &'a mut dyn Console);

impl<'a> ReporterVisitor for GithubReporterVisitor<'a> {
impl ReporterVisitor for GithubReporterVisitor<'_> {
fn report_summary(
&mut self,
_execution: &Execution,
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_cli/src/reporter/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<'a> GitLabReporterVisitor<'a> {
}
}

impl<'a> ReporterVisitor for GitLabReporterVisitor<'a> {
impl ReporterVisitor for GitLabReporterVisitor<'_> {
fn report_summary(&mut self, _: &Execution, _: TraversalSummary) -> std::io::Result<()> {
Ok(())
}
Expand All @@ -81,7 +81,7 @@ struct GitLabDiagnostics<'a>(
Option<&'a Utf8Path>,
);

impl<'a> GitLabDiagnostics<'a> {
impl GitLabDiagnostics<'_> {
fn attempt_to_relativize(&self, subject: &str) -> Option<Utf8PathBuf> {
let Ok(resolved) = Path::new(subject).absolutize() else {
return None;
Expand Down Expand Up @@ -117,7 +117,7 @@ impl<'a> GitLabDiagnostics<'a> {
}
}

impl<'a> Display for GitLabDiagnostics<'a> {
impl Display for GitLabDiagnostics<'_> {
fn fmt(&self, fmt: &mut Formatter) -> std::io::Result<()> {
let mut hasher = self.1.write().unwrap();
let gitlab_diagnostics: Vec<_> = self
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_cli/src/reporter/junit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct JunitDiagnostic<'a> {
diagnostic: &'a Error,
}

impl<'a> Display for JunitDiagnostic<'a> {
impl Display for JunitDiagnostic<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
self.diagnostic.description(f)
}
Expand All @@ -39,7 +39,7 @@ impl<'a> JunitReporterVisitor<'a> {
}
}

impl<'a> ReporterVisitor for JunitReporterVisitor<'a> {
impl ReporterVisitor for JunitReporterVisitor<'_> {
fn report_summary(
&mut self,
_execution: &Execution,
Expand Down
6 changes: 3 additions & 3 deletions crates/biome_cli/src/reporter/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Reporter for SummaryReporter {

pub(crate) struct SummaryReporterVisitor<'a>(pub(crate) &'a mut dyn Console);

impl<'a> ReporterVisitor for SummaryReporterVisitor<'a> {
impl ReporterVisitor for SummaryReporterVisitor<'_> {
fn report_summary(
&mut self,
execution: &Execution,
Expand Down Expand Up @@ -184,7 +184,7 @@ struct LintSummaryDiagnostic<'a> {
#[derive(Debug)]
struct SummaryListAdvice<'a>(&'a BTreeSet<String>);

impl<'a> Advices for SummaryListAdvice<'a> {
impl Advices for SummaryListAdvice<'_> {
fn record(&self, visitor: &mut dyn Visit) -> io::Result<()> {
let list: Vec<_> = self.0.iter().map(|s| s as &dyn Display).collect();
visitor.record_list(&list)
Expand Down Expand Up @@ -268,7 +268,7 @@ impl LintsByCategory {
}
}

impl<'a> Advices for &'a LintsByCategory {
impl Advices for &LintsByCategory {
fn record(&self, visitor: &mut dyn Visit) -> io::Result<()> {
let headers = &[
markup!("Rule Name").to_owned(),
Expand Down
8 changes: 4 additions & 4 deletions crates/biome_cli/src/reporter/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct FixedPathsDiagnostic {

pub(crate) struct ConsoleReporterVisitor<'a>(pub(crate) &'a mut dyn Console);

impl<'a> ReporterVisitor for ConsoleReporterVisitor<'a> {
impl ReporterVisitor for ConsoleReporterVisitor<'_> {
fn report_summary(
&mut self,
execution: &Execution,
Expand Down Expand Up @@ -148,7 +148,7 @@ impl fmt::Display for Files {

struct SummaryDetail<'a>(pub(crate) &'a TraversalMode, usize);

impl<'a> fmt::Display for SummaryDetail<'a> {
impl fmt::Display for SummaryDetail<'_> {
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
if let TraversalMode::Search { .. } = self.0 {
return Ok(());
Expand All @@ -167,7 +167,7 @@ impl<'a> fmt::Display for SummaryDetail<'a> {
}
struct SummaryTotal<'a>(&'a TraversalMode, usize, &'a Duration);

impl<'a> fmt::Display for SummaryTotal<'a> {
impl fmt::Display for SummaryTotal<'_> {
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
let files = Files(self.1);
match self.0 {
Expand Down Expand Up @@ -211,7 +211,7 @@ pub(crate) struct ConsoleTraversalSummary<'a>(
pub(crate) &'a TraversalMode,
pub(crate) &'a TraversalSummary,
);
impl<'a> fmt::Display for ConsoleTraversalSummary<'a> {
impl fmt::Display for ConsoleTraversalSummary<'_> {
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
let summary = SummaryTotal(self.0, self.1.changed + self.1.unchanged, &self.1.duration);
let detail = SummaryDetail(self.0, self.1.changed);
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_configuration/src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ impl serde::Serialize for RuleSelector {
impl<'de> serde::Deserialize<'de> for RuleSelector {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
impl serde::de::Visitor<'_> for Visitor {
type Value = RuleSelector;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("<group>/<rule_name>")
Expand Down
1 change: 0 additions & 1 deletion crates/biome_console/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{markup, Markup};
use std::io;

/// It displays a type that implements [std::fmt::Display]

pub struct DebugDisplay<T>(pub T);

impl<T> Display for DebugDisplay<T>
Expand Down
2 changes: 0 additions & 2 deletions crates/biome_css_analyze/src/services/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use biome_rowan::{AstNode, TextRange, WalkEvent};
/// type State = ();
/// type Signals = Option<Self::State>;
/// type Options = ();

/// fn run(ctx: &RuleContext<Self>) -> Self::Signals {
/// let node = ctx.query();
/// for n in node.rules() {
Expand Down Expand Up @@ -154,7 +153,6 @@ impl QueryMatch for SemanticModelEvent {
/// type State = ();
/// type Signals = Option<Self::State>;
/// type Options = ();

/// fn run(ctx: &RuleContext<Self>) -> Self::Signals {
/// let node = ctx.query();
/// // The model holds all information about the semantic.
Expand Down
15 changes: 12 additions & 3 deletions crates/biome_css_formatter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ impl<T, C> AsFormat<C> for &T
where
T: AsFormat<C>,
{
type Format<'a> = T::Format<'a> where Self: 'a;
type Format<'a>
= T::Format<'a>
where
Self: 'a;

fn format(&self) -> Self::Format<'_> {
AsFormat::format(&**self)
Expand All @@ -57,7 +60,10 @@ impl<T, C> AsFormat<C> for biome_rowan::SyntaxResult<T>
where
T: AsFormat<C>,
{
type Format<'a> = biome_rowan::SyntaxResult<T::Format<'a>> where Self: 'a;
type Format<'a>
= biome_rowan::SyntaxResult<T::Format<'a>>
where
Self: 'a;

fn format(&self) -> Self::Format<'_> {
match self {
Expand All @@ -74,7 +80,10 @@ impl<T, C> AsFormat<C> for Option<T>
where
T: AsFormat<C>,
{
type Format<'a> = Option<T::Format<'a>> where Self: 'a;
type Format<'a>
= Option<T::Format<'a>>
where
Self: 'a;

fn format(&self) -> Self::Format<'_> {
self.as_ref().map(|value| value.format())
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/utils/block_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> FormatCssBlockLike<'a> {
}
}

impl<'a> Format<CssFormatContext> for FormatCssBlockLike<'a> {
impl Format<CssFormatContext> for FormatCssBlockLike<'_> {
fn fmt(&self, f: &mut Formatter<CssFormatContext>) -> FormatResult<()> {
write!(f, [self.block.l_curly_token().format()])?;

Expand Down
4 changes: 2 additions & 2 deletions crates/biome_css_parser/src/token_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<'src> CssTokenSource<'src> {
}
}

impl<'source> TokenSource for CssTokenSource<'source> {
impl TokenSource for CssTokenSource<'_> {
type Kind = CssSyntaxKind;

fn current(&self) -> Self::Kind {
Expand Down Expand Up @@ -114,7 +114,7 @@ impl<'source> TokenSource for CssTokenSource<'source> {
}
}

impl<'source> BumpWithContext for CssTokenSource<'source> {
impl BumpWithContext for CssTokenSource<'_> {
type Context = CssLexContext;

fn bump_with_context(&mut self, context: Self::Context) {
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_deserialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<'a> DefaultDeserializationContext<'a> {
}
}
}
impl<'a> DeserializationContext for DefaultDeserializationContext<'a> {
impl DeserializationContext for DefaultDeserializationContext<'_> {
// Identifier of the deserialized root value.
fn id(&self) -> Option<&str> {
self.id
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_formatter/src/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'fmt, Context> Argument<'fmt, Context> {
}
}

impl<'fmt, Context> Format<Context> for Argument<'fmt, Context> {
impl<Context> Format<Context> for Argument<'_, Context> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter<Context>) -> FormatResult<()> {
self.format(f)
Expand Down
Loading
Loading