test-distro: reduce indentation

reviewable/pr1243/r5
Tamir Duberstein 2 weeks ago
parent af7cb8f2e9
commit 0099193bb5
No known key found for this signature in database

@ -41,7 +41,9 @@ fn main() -> anyhow::Result<()> {
let mut output = BufWriter::new(&f); let mut output = BufWriter::new(&f);
for entry in WalkDir::new(modules_dir) { for entry in WalkDir::new(modules_dir) {
let entry = entry.context("failed to read entry in walkdir")?; let entry = entry.context("failed to read entry in walkdir")?;
if entry.file_type().is_file() { if !entry.file_type().is_file() {
continue;
}
let path = entry.path(); let path = entry.path();
let module_name = path let module_name = path
@ -50,8 +52,7 @@ fn main() -> anyhow::Result<()> {
.to_str() .to_str()
.ok_or_else(|| anyhow!("{} is not valid utf-8", path.display()))?; .ok_or_else(|| anyhow!("{} is not valid utf-8", path.display()))?;
let (module_name, compressed) = let (module_name, compressed) = if let Some(module_name) = module_name.strip_suffix(".xz") {
if let Some(module_name) = module_name.strip_suffix(".xz") {
(module_name, true) (module_name, true)
} else { } else {
(module_name, false) (module_name, false)
@ -67,10 +68,8 @@ fn main() -> anyhow::Result<()> {
let contents = read_to_end(path, compressed) let contents = read_to_end(path, compressed)
.with_context(|| format!("read_to_end({})", path.display()))?; .with_context(|| format!("read_to_end({})", path.display()))?;
read_aliases_from_module(&contents, module_name, &mut output).with_context(|| { read_aliases_from_module(&contents, module_name, &mut output)
format!("failed to read aliases from module {}", path.display()) .with_context(|| format!("failed to read aliases from module {}", path.display()))?;
})?;
}
} }
Ok(()) Ok(())
} }

Loading…
Cancel
Save