Skip to content

Commit d63646e

Browse files
committed
Refactor: Simplify error mappings and standardize formatting
- Adjust YAML/JSON error mapping for improved readability. - Fix minor indentation issue in seccomp configuration. - Maintain consistent formatting across affected files (`vmm/mod.rs` and `spec.rs`).
1 parent 1a8581c commit d63646e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/spec.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,11 @@ pub fn load_spec(path: &Path) -> Result<RunSpec> {
178178
.unwrap_or(false);
179179

180180
let spec: RunSpec = if is_yaml {
181-
serde_yaml::from_str(&raw).map_err(|e| {
182-
Error::Config(format!("invalid YAML spec {}: {}", path.display(), e))
183-
})?
181+
serde_yaml::from_str(&raw)
182+
.map_err(|e| Error::Config(format!("invalid YAML spec {}: {}", path.display(), e)))?
184183
} else {
185-
serde_json::from_str(&raw).map_err(|e| {
186-
Error::Config(format!("invalid JSON spec {}: {}", path.display(), e))
187-
})?
184+
serde_json::from_str(&raw)
185+
.map_err(|e| Error::Config(format!("invalid JSON spec {}: {}", path.display(), e)))?
188186
};
189187

190188
validate_spec(&spec)?;

src/vmm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ fn install_seccomp_filter() -> Result<()> {
763763
let filter = SeccompFilter::new(
764764
rules,
765765
SeccompAction::KillThread, // Default: kill thread (not process) for unlisted syscalls
766-
SeccompAction::Allow, // Matched rules: allow
766+
SeccompAction::Allow, // Matched rules: allow
767767
std::env::consts::ARCH
768768
.try_into()
769769
.map_err(|_| Error::Config("Unsupported architecture for seccomp".into()))?,

0 commit comments

Comments
 (0)