Skip to content

Commit ae5656f

Browse files
committed
fix: lint
1 parent 6d27011 commit ae5656f

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

crates/pglt_analyser/tests/rules_tests.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn rule_test(full_path: &'static str, _: &str, _: &str) {
2323
};
2424

2525
let query =
26-
read_to_string(full_path).expect(format!("Failed to read file: {} ", full_path).as_str());
26+
read_to_string(full_path).unwrap_or_else(|_| panic!("Failed to read file: {} ", full_path));
2727

2828
let ast = pglt_query_ext::parse(&query).expect("failed to parse SQL");
2929
let options = AnalyserOptions::default();
@@ -51,7 +51,6 @@ fn rule_test(full_path: &'static str, _: &str, _: &str) {
5151
fn parse_test_path(path: &Path) -> (String, String, String) {
5252
let mut comps: Vec<&str> = path
5353
.components()
54-
.into_iter()
5554
.map(|c| c.as_os_str().to_str().unwrap())
5655
.collect();
5756

@@ -97,13 +96,10 @@ impl Expectation {
9796
}
9897

9998
fn assert(&self, diagnostics: &[RuleDiagnostic]) {
100-
match self {
101-
Self::NoDiagnostics => {
102-
if !diagnostics.is_empty() {
103-
panic!("This test should not have any diagnostics.");
104-
}
99+
if let Self::NoDiagnostics = self {
100+
if !diagnostics.is_empty() {
101+
panic!("This test should not have any diagnostics.");
105102
}
106-
_ => {}
107103
}
108104
}
109105
}

crates/pglt_test_macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl TryFrom<PathBuf> for Variables {
227227
Ok(Variables {
228228
test_name: test_name.into(),
229229
test_fullpath: test_fullpath.into(),
230-
test_expected_fullpath: test_expected_fullpath.into(),
230+
test_expected_fullpath,
231231
test_dir: test_dir.into(),
232232
})
233233
}

xtask/codegen/src/generate_new_analyser_rule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Rule for {rule_name_upper_camel} {{
7373
)
7474
}
7575

76-
static EXAMPLE_SQL: &'static str = r#"
76+
static EXAMPLE_SQL: &str = r#"
7777
-- select 1;
7878
"#;
7979

0 commit comments

Comments
 (0)