🚨 Fix clippy warnings

This commit is contained in:
2024-03-30 18:24:04 +01:00
parent 448b81b65d
commit 83fe388e8d
6 changed files with 73 additions and 68 deletions

View File

@@ -41,14 +41,14 @@ impl<'a> CssColorVariable<'a> {
pub fn to_rust(&self) -> String {
format!(
"const {name}: &str = \"{value}\";",
name = self.name.replace("-", "_").to_uppercase(),
name = self.name.replace('-', "_").to_uppercase(),
value = self.value
)
}
}
fn export_color_variables(src_path: &PathBuf, dst_path: &PathBuf) {
let mut dst_file = File::create(&dst_path).unwrap();
let mut dst_file = File::create(dst_path).unwrap();
if let Err(err) = dst_file.write(b"#[allow(dead_code)]\nmod style {") {
println!("{}", err);
return;
@@ -57,7 +57,7 @@ fn export_color_variables(src_path: &PathBuf, dst_path: &PathBuf) {
let re = Regex::new(r"^\$([^:]+):[[:space:]]*#([^$]+);[[:space:]]*$").unwrap();
if let Ok(lines) = read_lines(src_path) {
for line in lines.flatten() {
for line in lines.map_while(Result::ok) {
let Some(groups) = re.captures(&line) else {
continue;
};