Skip to content

Commit

Permalink
Compound implement the Hash trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Feb 26, 2020
1 parent 01ef21c commit 96baecb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minimad"
version = "0.6.3"
version = "0.6.4"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/minimad"
description = "light Markdown parser"
Expand Down
13 changes: 1 addition & 12 deletions src/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl Default for Alignment {

/// a Compound is a part of a line with a consistent styling.
/// It can be part of word, several words, some inline code, or even the whole line.
#[derive(Clone)]
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct Compound<'s> {
pub src: &'s str,
pub bold: bool,
Expand Down Expand Up @@ -234,14 +234,3 @@ impl fmt::Debug for Compound<'_> {
}
}

impl PartialEq for Compound<'_> {
fn eq(&self, other: &Compound<'_>) -> bool {
self.as_str() == other.as_str()
&& self.bold == other.bold
&& self.italic == other.italic
&& self.code == other.code
&& self.strikeout == other.strikeout
}
}
impl Eq for Compound<'_> {}

1 change: 1 addition & 0 deletions src/inline_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::Composite;
struct Arg {
compounds_idx: Vec<usize>, // indexes of the compounds the arg should fill
}
#[allow(dead_code)] // this isn't really dead code, it depends on the macro used
impl Arg {
fn add(&mut self, idx: usize) {
self.compounds_idx.push(idx);
Expand Down

0 comments on commit 96baecb

Please sign in to comment.