refactor: remove thiserror from dependencies
This commit is contained in:
parent
87661a2611
commit
1d5e98d4ea
3 changed files with 14 additions and 9 deletions
|
|
@ -14,12 +14,12 @@ rust-version = "1.65.0"
|
|||
libc = "0.2.149"
|
||||
sctk = { package = "smithay-client-toolkit", version = "0.18.0", default-features = false, features = ["calloop"] }
|
||||
wayland-backend = { version = "0.3.0", default_features = false, features = ["client_system"] }
|
||||
thiserror = "1.0.57"
|
||||
|
||||
[dev-dependencies]
|
||||
sctk = { package = "smithay-client-toolkit", version = "0.18.0", default-features = false, features = ["calloop", "xkbcommon"] }
|
||||
url = "2.5.0"
|
||||
dirs = "5.0.1"
|
||||
sctk = { package = "smithay-client-toolkit", version = "0.18.0", default-features = false, features = ["calloop", "xkbcommon"] }
|
||||
thiserror = "1.0.57"
|
||||
url = "2.5.0"
|
||||
|
||||
[features]
|
||||
default = ["dlopen"]
|
||||
|
|
|
|||
15
src/mime.rs
15
src/mime.rs
|
|
@ -1,16 +1,21 @@
|
|||
use std::borrow::Cow;
|
||||
use thiserror::Error;
|
||||
use std::{error, fmt};
|
||||
|
||||
/// List of allowed mimes.
|
||||
pub static ALLOWED_TEXT_MIME_TYPES: [&str; 3] =
|
||||
["text/plain;charset=utf-8", "UTF8_STRING", "text/plain"];
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Unsupported mime type")]
|
||||
Unsupported,
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct Error;
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "Unsupported mime type")
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for Error {}
|
||||
|
||||
/// Mime type supported by clipboard.
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Default)]
|
||||
#[repr(u8)]
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl TryFrom<(Vec<u8>, MimeType)> for Text {
|
|||
let content = match mime_type {
|
||||
MimeType::TextPlainUtf8 | MimeType::TextPlain => normalize_to_lf(content),
|
||||
MimeType::Utf8String => content,
|
||||
MimeType::Other(_) => return Err(Error::Unsupported),
|
||||
MimeType::Other(_) => return Err(Error),
|
||||
};
|
||||
Ok(Text(content))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue