History

fix: add standard traits (Debug, Eq) to `Snapshot` (#1424)

Sebastian Thiel committed 2 years ago

Commit 98007e61 parent 8d89b863 files · +4 −5Browse files

Unified · Split

3 files
  1. gix-mailmap/src/lib.rs +1 −1
  2. gix-mailmap/src/snapshot/entry.rs +2 −2
  3. gix-mailmap/src/snapshot/util.rs +1 −2
gix-mailmap/src/lib.rs+1−1
@@ -38,7 +38,7 @@ pub mod snapshot; · 37 unmodified lines
38/// optionally name to find mappings to new names and/or emails.38/// optionally name to find mappings to new names and/or emails.
39///39///
40/// The memory layout is efficient, even though lots of small allocations are performed to store strings of emails and names.40/// The memory layout is efficient, even though lots of small allocations are performed to store strings of emails and names.
41#[derive(Default, Clone)]41#[derive(Default, Clone, Debug, Eq, PartialEq)]
42pub struct Snapshot {42pub struct Snapshot {
43 /// Sorted by `old_email`43 /// Sorted by `old_email`
44 entries_by_old_email: Vec<snapshot::EmailEntry>,44 entries_by_old_email: Vec<snapshot::EmailEntry>,
gix-mailmap/src/snapshot/entry.rs+2−2
@@ -2,14 +2,14 @@ use bstr::BString; · 1 unmodified line
2 2
3use crate::snapshot::util::{EncodedString, EncodedStringRef};3use crate::snapshot::util::{EncodedString, EncodedStringRef};
4 4
5#[derive(Clone)]5#[derive(Clone, Debug, Eq, PartialEq)]
6pub(crate) struct NameEntry {6pub(crate) struct NameEntry {
7 pub(crate) new_name: Option<BString>,7 pub(crate) new_name: Option<BString>,
8 pub(crate) new_email: Option<BString>,8 pub(crate) new_email: Option<BString>,
9 pub(crate) old_name: EncodedString,9 pub(crate) old_name: EncodedString,
10}10}
11 11
12#[derive(Clone)]12#[derive(Clone, Debug, Eq, PartialEq)]
13pub(crate) struct EmailEntry {13pub(crate) struct EmailEntry {
14 pub(crate) new_name: Option<BString>,14 pub(crate) new_name: Option<BString>,
15 pub(crate) new_email: Option<BString>,15 pub(crate) new_email: Option<BString>,
gix-mailmap/src/snapshot/util.rs+1−2
@@ -2,8 +2,7 @@ use std::{cmp::Ordering, ops::Deref}; · 1 unmodified line
2 2
3use bstr::{BStr, BString, ByteSlice};3use bstr::{BStr, BString, ByteSlice};
4 4
5#[cfg_attr(test, derive(Debug))]5#[derive(Clone, Debug, Eq, PartialEq)]
6#[derive(Clone)]
7pub enum EncodedString {6pub enum EncodedString {
8 Utf8(String),7 Utf8(String),
9 Unknown(BString),8 Unknown(BString),