chore: clippy
This commit is contained in:
parent
3e56207b3a
commit
56039608a0
3 changed files with 5 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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]>>;
|
||||
|
|
|
|||
|
|
@ -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()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue