diff options
| author | 2024-09-18 02:22:52 +0200 | |
|---|---|---|
| committer | 2024-09-18 02:22:52 +0200 | |
| commit | ddcf9262f5a3cfba6452d009a9b09cd5044be71b (patch) | |
| tree | 56c34bcbc57d59b0ffc272d01ae1a5a577fc635f /examples/changelog/src | |
| parent | 4c9223c1cb9da56908c9fceb3218f38890e0218e (diff) | |
| download | iced-ddcf9262f5a3cfba6452d009a9b09cd5044be71b.tar.gz iced-ddcf9262f5a3cfba6452d009a9b09cd5044be71b.tar.bz2 iced-ddcf9262f5a3cfba6452d009a9b09cd5044be71b.zip | |
Fix duplicated contributions in `changelog` tool
Diffstat (limited to '')
| -rw-r--r-- | examples/changelog/src/changelog.rs | 12 | 
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)      }  } | 
