From faf00d104752f6c2b1902432f4fcb115f305724d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Sun, 30 Oct 2022 14:20:47 +0100 Subject: [PATCH] Fix clippy::derive_partial_eq_without_eq --- components/content/src/file_info.rs | 2 +- components/content/src/front_matter/page.rs | 2 +- components/content/src/front_matter/section.rs | 2 +- components/content/src/page.rs | 2 +- components/content/src/pagination.rs | 6 +++--- components/content/src/section.rs | 2 +- components/content/src/ser.rs | 8 ++++---- components/content/src/taxonomies.rs | 10 ++++++---- components/content/src/types.rs | 2 +- components/markdown/src/shortcode/parser.rs | 2 +- components/site/src/feed.rs | 2 +- components/utils/src/site.rs | 2 +- components/utils/src/table_of_contents.rs | 2 +- components/utils/src/templates.rs | 2 +- components/utils/src/types.rs | 2 +- 15 files changed, 25 insertions(+), 23 deletions(-) diff --git a/components/content/src/file_info.rs b/components/content/src/file_info.rs index 941d8ea1..3f40e08c 100644 --- a/components/content/src/file_info.rs +++ b/components/content/src/file_info.rs @@ -26,7 +26,7 @@ pub fn find_content_components>(path: P) -> Vec { } /// Struct that contains all the information about the actual file -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct FileInfo { /// The full path to the .md file pub path: PathBuf, diff --git a/components/content/src/front_matter/page.rs b/components/content/src/front_matter/page.rs index 8213b671..97680457 100644 --- a/components/content/src/front_matter/page.rs +++ b/components/content/src/front_matter/page.rs @@ -12,7 +12,7 @@ use utils::de::{fix_toml_dates, from_toml_datetime}; use crate::front_matter::split::RawFrontMatter; /// The front matter of every page -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Deserialize)] #[serde(default)] pub struct PageFrontMatter { /// of the page diff --git a/components/content/src/front_matter/section.rs b/components/content/src/front_matter/section.rs index 9a266973..ee077799 100644 --- a/components/content/src/front_matter/section.rs +++ b/components/content/src/front_matter/section.rs @@ -11,7 +11,7 @@ use crate::SortBy; static DEFAULT_PAGINATE_PATH: &str = "page"; /// The front matter of every section -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] pub struct SectionFrontMatter { /// <title> of the page diff --git a/components/content/src/page.rs b/components/content/src/page.rs index 1fca26a5..1e1ae8fb 100644 --- a/components/content/src/page.rs +++ b/components/content/src/page.rs @@ -33,7 +33,7 @@ static RFC3339_DATE: Lazy<Regex> = Lazy::new(|| { static FOOTNOTES_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r#"<sup class="footnote-reference"><a href=\s*.*?>\s*.*?</a></sup>"#).unwrap()); -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Page { /// All info about the actual file pub file: FileInfo, diff --git a/components/content/src/pagination.rs b/components/content/src/pagination.rs index d4d23de0..28182473 100644 --- a/components/content/src/pagination.rs +++ b/components/content/src/pagination.rs @@ -13,14 +13,14 @@ use crate::ser::{SectionSerMode, SerializingPage, SerializingSection}; use crate::taxonomies::{Taxonomy, TaxonomyTerm}; use crate::Section; -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] enum PaginationRoot<'a> { Section(&'a Section), Taxonomy(&'a Taxonomy, &'a TaxonomyTerm), } /// A list of all the pages in the paginator with their index and links -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct Pager<'a> { /// The page number in the paginator (1-indexed) pub index: usize, @@ -43,7 +43,7 @@ impl<'a> Pager<'a> { } } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Paginator<'a> { /// All pages in the section/taxonomy all_pages: Cow<'a, [PathBuf]>, diff --git a/components/content/src/section.rs b/components/content/src/section.rs index 4dadfc20..83ca014e 100644 --- a/components/content/src/section.rs +++ b/components/content/src/section.rs @@ -17,7 +17,7 @@ use crate::ser::{SectionSerMode, SerializingSection}; use crate::utils::{find_related_assets, get_reading_analytics, has_anchor}; // Default is used to create a default index section if there is no _index.md in the root content directory -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Section { /// All info about the actual file pub file: FileInfo, diff --git a/components/content/src/ser.rs b/components/content/src/ser.rs index e27a49fb..532fec3d 100644 --- a/components/content/src/ser.rs +++ b/components/content/src/ser.rs @@ -8,13 +8,13 @@ use crate::{Page, Section}; use libs::tera::{Map, Value}; use utils::table_of_contents::Heading; -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct BackLink<'a> { pub permalink: &'a str, pub title: &'a Option<String>, } -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct TranslatedContent<'a> { pub lang: &'a str, pub permalink: &'a str, @@ -39,7 +39,7 @@ fn find_backlinks<'a>(relative_path: &str, library: &'a Library) -> Vec<BackLink backlinks } -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct SerializingPage<'a> { relative_path: &'a str, content: &'a str, @@ -134,7 +134,7 @@ impl<'a> SerializingPage<'a> { } } -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct SerializingSection<'a> { relative_path: &'a str, content: &'a str, diff --git a/components/content/src/taxonomies.rs b/components/content/src/taxonomies.rs index 8955bd79..b0699666 100644 --- a/components/content/src/taxonomies.rs +++ b/components/content/src/taxonomies.rs @@ -16,7 +16,7 @@ use crate::{Page, SortBy}; use crate::sorting::sort_pages; -#[derive(Debug, Clone, PartialEq, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct SerializedTaxonomyTerm<'a> { name: &'a str, slug: &'a str, @@ -104,7 +104,9 @@ impl PartialEq for TaxonomyTerm { } } -#[derive(Debug, Clone, PartialEq, Serialize)] +impl Eq for TaxonomyTerm {} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct SerializedTaxonomy<'a> { kind: &'a TaxonomyConfig, lang: &'a str, @@ -128,7 +130,7 @@ impl<'a> SerializedTaxonomy<'a> { } } /// All different taxonomies we have and their content -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Taxonomy { pub kind: TaxonomyConfig, pub lang: String, @@ -256,7 +258,7 @@ impl Taxonomy { } /// Only used while building the taxonomies -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub(crate) struct TaxonomyFound<'a> { pub lang: &'a str, pub slug: String, diff --git a/components/content/src/types.rs b/components/content/src/types.rs index 4d78303e..e9809986 100644 --- a/components/content/src/types.rs +++ b/components/content/src/types.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, Eq)] #[serde(rename_all = "lowercase")] pub enum SortBy { /// Most recent to oldest diff --git a/components/markdown/src/shortcode/parser.rs b/components/markdown/src/shortcode/parser.rs index 230c36cf..4ce30b7b 100644 --- a/components/markdown/src/shortcode/parser.rs +++ b/components/markdown/src/shortcode/parser.rs @@ -10,7 +10,7 @@ use utils::templates::ShortcodeFileType; pub const SHORTCODE_PLACEHOLDER: &str = "@@ZOLA_SC_PLACEHOLDER@@"; -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Eq)] pub struct Shortcode { pub(crate) name: String, pub(crate) args: Value, diff --git a/components/site/src/feed.rs b/components/site/src/feed.rs index 8db2cc46..5ae58368 100644 --- a/components/site/src/feed.rs +++ b/components/site/src/feed.rs @@ -10,7 +10,7 @@ use content::{Page, TaxonomyTerm}; use errors::Result; use utils::templates::render_template; -#[derive(Debug, Clone, PartialEq, Serialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct SerializedFeedTaxonomyItem<'a> { name: &'a str, slug: &'a str, diff --git a/components/utils/src/site.rs b/components/utils/src/site.rs index 3561c3fc..ca3287b6 100644 --- a/components/utils/src/site.rs +++ b/components/utils/src/site.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use errors::{anyhow, Result}; /// Result of a successful resolution of an internal link. -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub struct ResolvedInternalLink { /// Resolved link target, as absolute URL address. pub permalink: String, diff --git a/components/utils/src/table_of_contents.rs b/components/utils/src/table_of_contents.rs index 75bbf214..8110ee94 100644 --- a/components/utils/src/table_of_contents.rs +++ b/components/utils/src/table_of_contents.rs @@ -1,7 +1,7 @@ use serde::Serialize; /// Populated while receiving events from the markdown parser -#[derive(Debug, Default, PartialEq, Clone, Serialize)] +#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize)] pub struct Heading { pub level: u32, pub id: String, diff --git a/components/utils/src/templates.rs b/components/utils/src/templates.rs index 90847c76..b51206ba 100644 --- a/components/utils/src/templates.rs +++ b/components/utils/src/templates.rs @@ -15,7 +15,7 @@ macro_rules! render_default_tpl { }}; } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum ShortcodeFileType { Markdown, Html, diff --git a/components/utils/src/types.rs b/components/utils/src/types.rs index d4d53a15..8670589e 100644 --- a/components/utils/src/types.rs +++ b/components/utils/src/types.rs @@ -1,6 +1,6 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum InsertAnchor { Left,