Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit ffb7cd2

Browse files
committed
fix cargo-clippy
1 parent b91c1bb commit ffb7cd2

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

common/src/cache.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,12 @@ pub fn get_previous_image_path(output_name: &str) -> io::Result<(String, String)
7575

7676
let mut buf = Vec::with_capacity(64);
7777
File::open(filepath)?.read_to_end(&mut buf)?;
78-
let buf = String::from_utf8(buf).map_err(|e| {
79-
std::io::Error::new(
80-
std::io::ErrorKind::Other,
81-
format!("failed to decode bytes: {e}"),
82-
)
83-
})?;
78+
let buf = String::from_utf8(buf)
79+
.map_err(|e| std::io::Error::other(format!("failed to decode bytes: {e}")))?;
8480

8581
match buf.split_once("\n") {
8682
Some(buf) => Ok((buf.0.to_string(), buf.1.to_string())),
87-
None => Err(std::io::Error::new(
88-
std::io::ErrorKind::Other,
89-
"failed to read image filter",
90-
)),
83+
None => Err(std::io::Error::other("failed to read image filter")),
9184
}
9285
}
9386

@@ -100,9 +93,8 @@ pub fn load(output_name: &str) -> io::Result<()> {
10093
if let Ok(mut child) = std::process::Command::new("pidof").arg("swww").spawn() {
10194
if let Ok(status) = child.wait() {
10295
if status.success() {
103-
return Err(std::io::Error::new(
104-
std::io::ErrorKind::Other,
105-
"there is already another swww process running".to_string(),
96+
return Err(std::io::Error::other(
97+
"there is already another swww process running",
10698
));
10799
}
108100
}
@@ -181,9 +173,8 @@ fn cache_dir() -> io::Result<PathBuf> {
181173
create_dir(&path)?;
182174
Ok(path)
183175
} else {
184-
Err(std::io::Error::new(
185-
std::io::ErrorKind::Other,
186-
"failed to read both $XDG_CACHE_HOME and $HOME environment variables".to_string(),
176+
Err(std::io::Error::other(
177+
"failed to read both $XDG_CACHE_HOME and $HOME environment variables",
187178
))
188179
}
189180
}

0 commit comments

Comments
 (0)