diff options
| author | Xe Iaso <me@xeiaso.net> | 2023-08-21 21:24:19 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2023-08-21 21:24:19 -0400 |
| commit | ad1bc3c50ab5b0ca4acab5a22a71698128a0c879 (patch) | |
| tree | efc9f8dfdf9e2240f29df9f58d29f7989e791a6c /lib/jsonfeed | |
| parent | f670dafb8a89d8a1294ceab10318454e394c1cec (diff) | |
| download | xesite-ad1bc3c50ab5b0ca4acab5a22a71698128a0c879.tar.xz xesite-ad1bc3c50ab5b0ca4acab5a22a71698128a0c879.zip | |
lib/jsonfeed: clippy fixes
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'lib/jsonfeed')
| -rw-r--r-- | lib/jsonfeed/src/feed.rs | 2 | ||||
| -rw-r--r-- | lib/jsonfeed/src/item.rs | 8 | ||||
| -rw-r--r-- | lib/jsonfeed/src/lib.rs | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/jsonfeed/src/feed.rs b/lib/jsonfeed/src/feed.rs index 320feb6..dc0a2b5 100644 --- a/lib/jsonfeed/src/feed.rs +++ b/lib/jsonfeed/src/feed.rs @@ -3,7 +3,7 @@ use std::default::Default; use builder::Builder; use item::Item; -const VERSION_1: &'static str = "https://jsonfeed.org/version/1"; +const VERSION_1: &str = "https://jsonfeed.org/version/1"; /// Represents a single feed /// diff --git a/lib/jsonfeed/src/item.rs b/lib/jsonfeed/src/item.rs index 3b308cb..49593ab 100644 --- a/lib/jsonfeed/src/item.rs +++ b/lib/jsonfeed/src/item.rs @@ -306,9 +306,9 @@ impl<'de> Deserialize<'de> for Item { let id = id.ok_or_else(|| de::Error::missing_field("id"))?; let content = match (content_html, content_text) { - (Some(s), Some(t)) => Content::Both(s.to_string(), t.to_string()), - (Some(s), _) => Content::Html(s.to_string()), - (_, Some(t)) => Content::Text(t.to_string()), + (Some(s), Some(t)) => Content::Both(s, t), + (Some(s), _) => Content::Html(s), + (_, Some(t)) => Content::Text(t), _ => return Err(de::Error::missing_field("content_html or content_text")), }; @@ -331,7 +331,7 @@ impl<'de> Deserialize<'de> for Item { } } - const FIELDS: &'static [&'static str] = &[ + const FIELDS: &[&str] = &[ "id", "url", "external_url", diff --git a/lib/jsonfeed/src/lib.rs b/lib/jsonfeed/src/lib.rs index 812083e..d501161 100644 --- a/lib/jsonfeed/src/lib.rs +++ b/lib/jsonfeed/src/lib.rs @@ -39,6 +39,8 @@ //! } //! ``` +#![allow(clippy::new_without_default)] + extern crate serde; #[macro_use] extern crate error_chain; @@ -82,7 +84,7 @@ pub fn from_reader<R: ::std::io::Read>(r: R) -> Result<Feed> { } /// Deserialize a Feed object from bytes of JSON text -pub fn from_slice<'a>(v: &'a [u8]) -> Result<Feed> { +pub fn from_slice(v: &[u8]) -> Result<Feed> { Ok(serde_json::from_slice(v)?) } |
