aboutsummaryrefslogtreecommitdiff
path: root/lib/jsonfeed
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-08-21 21:24:19 -0400
committerXe Iaso <me@xeiaso.net>2023-08-21 21:24:19 -0400
commitad1bc3c50ab5b0ca4acab5a22a71698128a0c879 (patch)
treeefc9f8dfdf9e2240f29df9f58d29f7989e791a6c /lib/jsonfeed
parentf670dafb8a89d8a1294ceab10318454e394c1cec (diff)
downloadxesite-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.rs2
-rw-r--r--lib/jsonfeed/src/item.rs8
-rw-r--r--lib/jsonfeed/src/lib.rs4
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)?)
}