chore: clippy

This commit is contained in:
Ashley Wulber 2024-02-27 17:54:18 -05:00
parent 3e56207b3a
commit 56039608a0
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 5 additions and 9 deletions

View file

@ -58,12 +58,8 @@ impl Clipboard {
if let Ok(reply) = self.request_receiver.recv() {
match reply {
Ok((data, mime)) => {
T::try_from((data, mime)).map_err(|err| std::io::Error::other(err))
},
Err(err) => {
return Err(err);
},
Ok((data, mime)) => T::try_from((data, mime)).map_err(std::io::Error::other),
Err(err) => Err(err),
}
} else {
// The clipboard thread is dead, however we shouldn't crash downstream, so

View file

@ -37,7 +37,7 @@ impl AsRef<str> for MimeType {
fn as_ref(&self) -> &str {
match self {
MimeType::Other(s) => s.as_ref(),
m => &ALLOWED_TEXT_MIME_TYPES[m.discriminant() as usize],
m => ALLOWED_TEXT_MIME_TYPES[m.discriminant() as usize],
}
}
}
@ -56,7 +56,7 @@ pub trait AllowedMimeTypes: TryFrom<(Vec<u8>, MimeType)> {
/// Can be converted to data with the available mime types
pub trait AsMimeTypes {
/// Available mime types for this data
fn available<'a>(&'a self) -> Cow<'static, [MimeType]>;
fn available(&self) -> Cow<'static, [MimeType]>;
/// Data as a specific mime_type
fn as_bytes(&self, mime_type: &MimeType) -> Option<Cow<'static, [u8]>>;

View file

@ -35,7 +35,7 @@ impl AsMimeTypes for Text {
Self::allowed()
}
fn as_bytes<'a>(&'a self, mime_type: &MimeType) -> Option<Cow<'static, [u8]>> {
fn as_bytes(&self, mime_type: &MimeType) -> Option<Cow<'static, [u8]>> {
match mime_type {
MimeType::TextPlainUtf8 | MimeType::Utf8String | MimeType::TextPlain => {
Some(Cow::Owned(self.0.as_bytes().to_owned()))