tony / oxwm

use `anyhow::Context` instead of mapping Browse files
emzywastaken committed 2025-10-16 parent 6225625 commit 9a1df9a5cac52225af8b5d33e02256fd89431c45
Showing 1 changed file with 4 additions and 5 deletions. UnifiedSplit
+4 −5 src/bin/main.rs
@@ -1,4 +1,4 @@
1 -use anyhow::Result;
1 +use anyhow::{Context, Result};
2 2 use std::path::PathBuf;
3 3
4 4 fn main() -> Result<()> {
@@ -45,11 +45,10 @@ fn load_config() -> Result<oxwm::Config> {
45 45 init_config()?;
46 46 }
47 47
48 - let config_str = std::fs::read_to_string(&config_path)
49 - .map_err(|e| anyhow::anyhow!("Failed to read config file: {}", e))?;
48 + let config_str =
49 + std::fs::read_to_string(&config_path).with_context(|| "Failed to read config file")?;
50 50
51 - oxwm::config::parse_config(&config_str)
52 - .map_err(|e| anyhow::anyhow!("Failed to parse config: {}", e))
51 + oxwm::config::parse_config(&config_str).with_context(|| "Failed to parse config")
53 52 }
54 53
55 54 fn init_config() -> Result<()> {