Skip to content

Commit b4832eb

Browse files
committed
fix
1 parent 8e8433c commit b4832eb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/clip.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ pub fn copy_to_clipboard(content: &str) -> anyhow::Result<()> {
66
Err(e) => return Err(anyhow::anyhow!("ClipboardContext Error: {}", e)),
77
};
88

9-
match ctx.set_contents(content.to_owned()) {
10-
Ok(ctx) => ctx,
11-
Err(e) => return Err(anyhow::anyhow!("Set Contents Error: {}", e)),
12-
};
9+
if let Err(e) = ctx.set_contents(content.to_owned()) {
10+
return Err(anyhow::anyhow!("Set Contents Error: {}", e));
11+
}
1312

14-
match ctx.get_contents() {
15-
Ok(ctx) => ctx,
16-
Err(e) => return Err(anyhow::anyhow!("Get Contents Error: {}", e)),
17-
};
13+
if let Err(e) = ctx.get_contents() {
14+
return Err(anyhow::anyhow!("Get Contents Error: {}", e));
15+
}
1816

1917
Ok(())
2018
}

0 commit comments

Comments
 (0)