Skip to content

Commit

Permalink
Fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu authored and complexspaces committed Apr 12, 2024
1 parent 2f4b502 commit e2846f9
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/platform/linux/wayland.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::borrow::Cow;
use std::convert::TryInto;
use std::io::Read;

use wl_clipboard_rs::{
Expand Down Expand Up @@ -82,11 +81,7 @@ impl Clipboard {
wait: WaitConfig,
) -> Result<(), Error> {
let mut opts = Options::new();
opts.foreground(match wait {
WaitConfig::Forever => true,
_ => false,
});

opts.foreground(matches!(wait, WaitConfig::Forever));
opts.clipboard(selection.try_into()?);
let source = Source::Bytes(text.into_owned().into_bytes().into_boxed_slice());
opts.copy(source, MimeType::Text).map_err(|e| match e {
Expand All @@ -105,11 +100,7 @@ impl Clipboard {
) -> Result<(), Error> {
let html_mime = MimeType::Specific(String::from("text/html"));
let mut opts = Options::new();
opts.foreground(match wait {
WaitConfig::Forever => true,
_ => false,
});

opts.foreground(matches!(wait, WaitConfig::Forever));
opts.clipboard(selection.try_into()?);
let html_source = Source::Bytes(html.into_owned().into_bytes().into_boxed_slice());
match alt {
Expand Down Expand Up @@ -175,11 +166,7 @@ impl Clipboard {
) -> Result<(), Error> {
let image = encode_as_png(&image)?;
let mut opts = Options::new();
opts.foreground(match wait {
WaitConfig::Forever => true,
_ => false,
});

opts.foreground(matches!(wait, WaitConfig::Forever));
opts.clipboard(selection.try_into()?);
let source = Source::Bytes(image.into());
opts.copy(source, MimeType::Specific(MIME_PNG.into())).map_err(into_unknown)?;
Expand Down

0 comments on commit e2846f9

Please sign in to comment.