Skip to content

Commit 20ee92b

Browse files
authored
fix: change handling (#167)
* lets get into the mess... * woooorks now and its much simpler * fix: minor fixes * fix: lint --fix * format * format * pssssssht * fixes
1 parent c509dd6 commit 20ee92b

File tree

29 files changed

+583
-568
lines changed

29 files changed

+583
-568
lines changed

crates/pg_analyse/src/filter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'analysis> AnalysisFilter<'analysis> {
4242
/// Return `true` if the group `G` matches this filter
4343
pub fn match_group<G: RuleGroup>(&self) -> bool {
4444
self.match_category::<G::Category>()
45-
&& self.enabled_rules.map_or(true, |enabled_rules| {
45+
&& self.enabled_rules.is_none_or(|enabled_rules| {
4646
enabled_rules.iter().any(|filter| filter.match_group::<G>())
4747
})
4848
&& !self
@@ -54,7 +54,7 @@ impl<'analysis> AnalysisFilter<'analysis> {
5454
/// Return `true` if the rule `R` matches this filter
5555
pub fn match_rule<R: Rule>(&self) -> bool {
5656
self.match_category::<<R::Group as RuleGroup>::Category>()
57-
&& self.enabled_rules.map_or(true, |enabled_rules| {
57+
&& self.enabled_rules.is_none_or(|enabled_rules| {
5858
enabled_rules.iter().any(|filter| filter.match_rule::<R>())
5959
})
6060
&& !self
@@ -94,13 +94,13 @@ impl<'a> RuleFilter<'a> {
9494
}
9595
}
9696

97-
impl<'a> Debug for RuleFilter<'a> {
97+
impl Debug for RuleFilter<'_> {
9898
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
9999
Display::fmt(self, f)
100100
}
101101
}
102102

103-
impl<'a> Display for RuleFilter<'a> {
103+
impl Display for RuleFilter<'_> {
104104
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
105105
match self {
106106
RuleFilter::Group(group) => {
@@ -113,7 +113,7 @@ impl<'a> Display for RuleFilter<'a> {
113113
}
114114
}
115115

116-
impl<'a> pg_console::fmt::Display for RuleFilter<'a> {
116+
impl pg_console::fmt::Display for RuleFilter<'_> {
117117
fn fmt(&self, fmt: &mut pg_console::fmt::Formatter) -> std::io::Result<()> {
118118
match self {
119119
RuleFilter::Group(group) => {

crates/pg_cli/src/commands/daemon.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub(crate) fn read_most_recent_log_file(
180180

181181
let most_recent = fs::read_dir(biome_log_path)?
182182
.flatten()
183-
.filter(|file| file.file_type().map_or(false, |ty| ty.is_file()))
183+
.filter(|file| file.file_type().is_ok_and(|ty| ty.is_file()))
184184
.filter_map(|file| {
185185
match file
186186
.file_name()

crates/pg_cli/src/commands/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl PgLspCommand {
230230

231231
pub fn is_verbose(&self) -> bool {
232232
self.cli_options()
233-
.map_or(false, |cli_options| cli_options.verbose)
233+
.is_some_and(|cli_options| cli_options.verbose)
234234
}
235235

236236
pub fn log_level(&self) -> LoggingLevel {

crates/pg_cli/src/execute/traverse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub(crate) struct TraversalOptions<'ctx, 'app> {
413413
pub(crate) evaluated_paths: RwLock<BTreeSet<PgLspPath>>,
414414
}
415415

416-
impl<'ctx, 'app> TraversalOptions<'ctx, 'app> {
416+
impl TraversalOptions<'_, '_> {
417417
pub(crate) fn increment_changed(&self, path: &PgLspPath) {
418418
self.changed.fetch_add(1, Ordering::Relaxed);
419419
self.evaluated_paths
@@ -441,7 +441,7 @@ impl<'ctx, 'app> TraversalOptions<'ctx, 'app> {
441441
}
442442
}
443443

444-
impl<'ctx, 'app> TraversalContext for TraversalOptions<'ctx, 'app> {
444+
impl TraversalContext for TraversalOptions<'_, '_> {
445445
fn interner(&self) -> &PathInterner {
446446
&self.interner
447447
}

crates/pg_cli/src/reporter/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Reporter for GithubReporter {
1616
}
1717
pub(crate) struct GithubReporterVisitor<'a>(pub(crate) &'a mut dyn Console);
1818

19-
impl<'a> ReporterVisitor for GithubReporterVisitor<'a> {
19+
impl ReporterVisitor for GithubReporterVisitor<'_> {
2020
fn report_summary(
2121
&mut self,
2222
_execution: &Execution,

crates/pg_cli/src/reporter/gitlab.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a> GitLabReporterVisitor<'a> {
5757
}
5858
}
5959

60-
impl<'a> ReporterVisitor for GitLabReporterVisitor<'a> {
60+
impl ReporterVisitor for GitLabReporterVisitor<'_> {
6161
fn report_summary(&mut self, _: &Execution, _: TraversalSummary) -> std::io::Result<()> {
6262
Ok(())
6363
}
@@ -80,7 +80,7 @@ struct GitLabDiagnostics<'a>(
8080
Option<&'a Path>,
8181
);
8282

83-
impl<'a> GitLabDiagnostics<'a> {
83+
impl GitLabDiagnostics<'_> {
8484
fn attempt_to_relativize(&self, subject: &str) -> Option<PathBuf> {
8585
let Ok(resolved) = Path::new(subject).absolutize() else {
8686
return None;
@@ -116,7 +116,7 @@ impl<'a> GitLabDiagnostics<'a> {
116116
}
117117
}
118118

119-
impl<'a> Display for GitLabDiagnostics<'a> {
119+
impl Display for GitLabDiagnostics<'_> {
120120
fn fmt(&self, fmt: &mut Formatter) -> std::io::Result<()> {
121121
let mut hasher = self.1.write().unwrap();
122122
let gitlab_diagnostics: Vec<_> = self

crates/pg_cli/src/reporter/junit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct JunitDiagnostic<'a> {
2424
diagnostic: &'a Error,
2525
}
2626

27-
impl<'a> Display for JunitDiagnostic<'a> {
27+
impl Display for JunitDiagnostic<'_> {
2828
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
2929
self.diagnostic.description(f)
3030
}
@@ -39,7 +39,7 @@ impl<'a> JunitReporterVisitor<'a> {
3939
}
4040
}
4141

42-
impl<'a> ReporterVisitor for JunitReporterVisitor<'a> {
42+
impl ReporterVisitor for JunitReporterVisitor<'_> {
4343
fn report_summary(
4444
&mut self,
4545
_execution: &Execution,

crates/pg_cli/src/reporter/terminal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct FixedPathsDiagnostic {
5353

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

56-
impl<'a> ReporterVisitor for ConsoleReporterVisitor<'a> {
56+
impl ReporterVisitor for ConsoleReporterVisitor<'_> {
5757
fn report_summary(
5858
&mut self,
5959
execution: &Execution,
@@ -132,7 +132,7 @@ impl fmt::Display for Files {
132132

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

135-
impl<'a> fmt::Display for SummaryDetail<'a> {
135+
impl fmt::Display for SummaryDetail<'_> {
136136
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
137137
if self.1 > 0 {
138138
fmt.write_markup(markup! {
@@ -147,7 +147,7 @@ impl<'a> fmt::Display for SummaryDetail<'a> {
147147
}
148148
struct SummaryTotal<'a>(&'a TraversalMode, usize, &'a Duration);
149149

150-
impl<'a> fmt::Display for SummaryTotal<'a> {
150+
impl fmt::Display for SummaryTotal<'_> {
151151
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
152152
let files = Files(self.1);
153153
match self.0 {
@@ -165,7 +165,7 @@ pub(crate) struct ConsoleTraversalSummary<'a>(
165165
pub(crate) &'a TraversalMode,
166166
pub(crate) &'a TraversalSummary,
167167
);
168-
impl<'a> fmt::Display for ConsoleTraversalSummary<'a> {
168+
impl fmt::Display for ConsoleTraversalSummary<'_> {
169169
fn fmt(&self, fmt: &mut Formatter) -> io::Result<()> {
170170
let summary = SummaryTotal(self.0, self.1.changed + self.1.unchanged, &self.1.duration);
171171
let detail = SummaryDetail(self.0, self.1.changed);

crates/pg_completions/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ async-std = "1.12.0"
1616

1717
text-size.workspace = true
1818

19+
1920
pg_schema_cache.workspace = true
2021
pg_treesitter_queries.workspace = true
2122
serde = { workspace = true, features = ["derive"] }

crates/pg_completions/src/relevance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub(crate) enum CompletionRelevanceData<'a> {
77
Column(&'a pg_schema_cache::Column),
88
}
99

10-
impl<'a> CompletionRelevanceData<'a> {
10+
impl CompletionRelevanceData<'_> {
1111
pub fn get_score(self, ctx: &CompletionContext) -> i32 {
1212
CompletionRelevance::from(self).into_score(ctx)
1313
}
@@ -28,7 +28,7 @@ pub(crate) struct CompletionRelevance<'a> {
2828
data: CompletionRelevanceData<'a>,
2929
}
3030

31-
impl<'a> CompletionRelevance<'a> {
31+
impl CompletionRelevance<'_> {
3232
pub fn into_score(mut self, ctx: &CompletionContext) -> i32 {
3333
self.check_matches_schema(ctx);
3434
self.check_matches_query_input(ctx);

0 commit comments

Comments
 (0)