summaryrefslogtreecommitdiffstats
path: root/examples/changelog
diff options
context:
space:
mode:
Diffstat (limited to 'examples/changelog')
-rw-r--r--examples/changelog/src/changelog.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/changelog/src/changelog.rs b/examples/changelog/src/changelog.rs
index 9421f91c..784efaa8 100644
--- a/examples/changelog/src/changelog.rs
+++ b/examples/changelog/src/changelog.rs
@@ -2,6 +2,7 @@ use serde::Deserialize;
use tokio::fs;
use tokio::process;
+use std::collections::BTreeSet;
use std::env;
use std::fmt;
use std::io;
@@ -261,7 +262,7 @@ impl fmt::Display for Category {
}
}
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct Contribution {
pub id: u64,
}
@@ -281,7 +282,7 @@ impl Contribution {
let log = String::from_utf8_lossy(&output.stdout);
- Ok(log
+ let mut contributions: Vec<_> = log
.lines()
.filter(|title| !title.is_empty())
.filter_map(|title| {
@@ -292,7 +293,12 @@ impl Contribution {
id: pull_request.parse().ok()?,
})
})
- .collect())
+ .collect();
+
+ let mut unique = BTreeSet::from_iter(contributions.clone());
+ contributions.retain_mut(|contribution| unique.remove(contribution));
+
+ Ok(contributions)
}
}