Skip to content

Commit 09c5718

Browse files
committed
progress
1 parent 964de40 commit 09c5718

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

xtask/codegen/src/generate_splinter.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use xtask::{glue::fs2, project_root};
88
pub fn generate_splinter() -> Result<()> {
99
let sql_path = project_root().join("crates/pgls_splinter/vendor/splinter.sql");
1010
let sql_content = fs::read_to_string(&sql_path)
11-
.with_context(|| format!("Failed to read SQL file at {:?}", sql_path))?;
11+
.with_context(|| format!("Failed to read SQL file at {sql_path:?}"))?;
1212

1313
let rules = extract_rules_from_sql(&sql_content)?;
1414

@@ -40,9 +40,8 @@ fn extract_rules_from_sql(content: &str) -> Result<BTreeMap<String, RuleInfo>> {
4040
}
4141
}
4242

43-
let url = remediation_url.with_context(|| {
44-
format!("Failed to find remediation URL for rule '{}'", name)
45-
})?;
43+
let url = remediation_url
44+
.with_context(|| format!("Failed to find remediation URL for rule '{name}'"))?;
4645

4746
rules.insert(
4847
name.clone(),
@@ -125,7 +124,7 @@ fn update_categories_file(rules: BTreeMap<String, RuleInfo>) -> Result<()> {
125124
&content,
126125
rules_start,
127126
rules_end,
128-
&format!("\n{}\n ", splinter_entries),
127+
&format!("\n{splinter_entries}\n "),
129128
)?;
130129

131130
fs2::write(categories_path, new_content)?;
@@ -142,11 +141,11 @@ fn replace_between_markers(
142141
) -> Result<String> {
143142
let start_pos = content
144143
.find(start_marker)
145-
.with_context(|| format!("Could not find '{}' marker", start_marker))?;
144+
.with_context(|| format!("Could not find '{start_marker}' marker"))?;
146145

147146
let end_pos = content
148147
.find(end_marker)
149-
.with_context(|| format!("Could not find '{}' marker", end_marker))?;
148+
.with_context(|| format!("Could not find '{end_marker}' marker"))?;
150149

151150
let mut result = String::new();
152151
result.push_str(&content[..start_pos + start_marker.len()]);

0 commit comments

Comments
 (0)