From 6473ff150f75cd5ac32dd8371be99d66acd16a3c Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 9 Mar 2023 12:04:45 +0100 Subject: [PATCH] strip leading dots from copyright statements --- src/tools/collect-license-metadata/src/licenses.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tools/collect-license-metadata/src/licenses.rs b/src/tools/collect-license-metadata/src/licenses.rs index 1c95b1bc8e9..2855069db0d 100644 --- a/src/tools/collect-license-metadata/src/licenses.rs +++ b/src/tools/collect-license-metadata/src/licenses.rs @@ -42,6 +42,7 @@ pub(crate) struct License { impl License { fn simplify(&mut self) { self.remove_copyright_prefixes(); + self.remove_trailing_dots(); self.copyright.sort(); self.copyright.dedup(); } @@ -62,4 +63,12 @@ impl License { *copyright = stripped.into(); } } + + fn remove_trailing_dots(&mut self) { + for copyright in &mut self.copyright { + if copyright.ends_with('.') { + *copyright = copyright.trim_end_matches('.').to_string(); + } + } + } }