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"
|
libc = "0.2.149"
|
||||||
sctk = { package = "smithay-client-toolkit", version = "0.18.0", default-features = false, features = ["calloop"] }
|
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"] }
|
wayland-backend = { version = "0.3.0", default_features = false, features = ["client_system"] }
|
||||||
thiserror = "1.0.57"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[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"
|
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]
|
[features]
|
||||||
default = ["dlopen"]
|
default = ["dlopen"]
|
||||||
|
|
|
||||||
15
src/mime.rs
15
src/mime.rs
|
|
@ -1,16 +1,21 @@
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use thiserror::Error;
|
use std::{error, fmt};
|
||||||
|
|
||||||
/// List of allowed mimes.
|
/// List of allowed mimes.
|
||||||
pub static ALLOWED_TEXT_MIME_TYPES: [&str; 3] =
|
pub static ALLOWED_TEXT_MIME_TYPES: [&str; 3] =
|
||||||
["text/plain;charset=utf-8", "UTF8_STRING", "text/plain"];
|
["text/plain;charset=utf-8", "UTF8_STRING", "text/plain"];
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum Error {
|
pub struct Error;
|
||||||
#[error("Unsupported mime type")]
|
|
||||||
Unsupported,
|
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.
|
/// Mime type supported by clipboard.
|
||||||
#[derive(Clone, Eq, PartialEq, Debug, Default)]
|
#[derive(Clone, Eq, PartialEq, Debug, Default)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ impl TryFrom<(Vec<u8>, MimeType)> for Text {
|
||||||
let content = match mime_type {
|
let content = match mime_type {
|
||||||
MimeType::TextPlainUtf8 | MimeType::TextPlain => normalize_to_lf(content),
|
MimeType::TextPlainUtf8 | MimeType::TextPlain => normalize_to_lf(content),
|
||||||
MimeType::Utf8String => content,
|
MimeType::Utf8String => content,
|
||||||
MimeType::Other(_) => return Err(Error::Unsupported),
|
MimeType::Other(_) => return Err(Error),
|
||||||
};
|
};
|
||||||
Ok(Text(content))
|
Ok(Text(content))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue