Skip to content

Commit b635628

Browse files
committed
fix
1 parent eb50d96 commit b635628

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

crates/squawk_linter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub enum ViolationMessage<'a> {
387387
#[derive(Debug)]
388388
pub struct ViolationMeta<'a> {
389389
/// A description of the rule that's used when rendering the error message
390-
/// in on the CLI. It should be a slightly expanded version of the [ViolationName]
390+
/// in on the CLI. It should be a slightly expanded version of the [`ViolationName`]
391391
pub title: String,
392392
/// Messages rendered for each error to provide context and offer advice on how to fix.
393393
pub messages: Vec<ViolationMessage<'a>>,

crates/squawk_linter/src/rules/ban_create_domain_with_constraint.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,27 @@ use crate::{ErrorCode, Linter, Violation};
99
pub(crate) fn ban_create_domain_with_constraint(ctx: &mut Linter, parse: &Parse<SourceFile>) {
1010
let file = parse.tree();
1111
for item in file.items() {
12-
match item {
13-
ast::Item::CreateDomain(domain) => {
14-
let range = domain.constraints().map(|c| c.syntax().text_range()).fold(
15-
None,
16-
|prev, cur| match prev {
12+
if let ast::Item::CreateDomain(domain) = item {
13+
let range =
14+
domain
15+
.constraints()
16+
.map(|c| c.syntax().text_range())
17+
.fold(None, |prev, cur| match prev {
1718
None => Some(cur),
1819
Some(prev) => {
1920
let new_start = prev.start().min(cur.start());
2021
let new_end = prev.end().max(cur.end());
2122
Some(TextRange::new(new_start, new_end))
2223
}
23-
},
24-
);
25-
if let Some(range) = range {
26-
ctx.report(Violation::new(
27-
ErrorCode::BanCreateDomainWithConstraint,
28-
"Domains with constraints have poor support for online migrations. Use table and column constraints instead.".into(),
29-
range,
30-
None,
31-
))
32-
}
24+
});
25+
if let Some(range) = range {
26+
ctx.report(Violation::new(
27+
ErrorCode::BanCreateDomainWithConstraint,
28+
"Domains with constraints have poor support for online migrations. Use table and column constraints instead.".into(),
29+
range,
30+
None,
31+
))
3332
}
34-
_ => (),
3533
}
3634
}
3735
}

0 commit comments

Comments
 (0)