Clean up a few #[allow]s (#2614)

This commit is contained in:
Johannes Agricola
2025-04-16 10:45:08 +02:00
committed by GitHub
parent 0e3767102a
commit e08d954573
10 changed files with 13 additions and 29 deletions
+5 -4
View File
@@ -7,9 +7,10 @@ static EMOJI_REPLACER: Lazy<gh_emoji::Replacer> =
// Replace markdown emojis with Unicode equivalent
// :hammer: --> 🔨
#[inline]
pub fn emojifi_string(s: &mut String) {
let resulting_cow = EMOJI_REPLACER.replace_all(s);
if let Cow::Owned(altered_s) = resulting_cow {
*s = altered_s;
pub fn emojifi_string(s: String) -> String {
if let Cow::Owned(altered_s) = EMOJI_REPLACER.replace_all(&s) {
altered_s
} else {
s
}
}
+3 -6
View File
@@ -41,12 +41,11 @@ impl From<CommitInfo> for LogEntry {
};
let author = c.author;
#[allow(unused_mut)]
let mut msg = c.message;
let msg = c.message;
// Replace markdown emojis with Unicode equivalent
#[cfg(feature = "ghemoji")]
emojifi_string(&mut msg);
let msg = emojifi_string(msg);
Self {
author: author.into(),
@@ -175,9 +174,7 @@ mod tests {
use super::*;
fn test_conversion(s: &str) -> String {
let mut s = s.to_string();
emojifi_string(&mut s);
s
emojifi_string(s.into())
}
#[test]
-2
View File
@@ -152,8 +152,6 @@ impl Options {
Ok(from_bytes(&buffer)?)
}
//TODO: fix once FP in clippy is fixed
#[allow(clippy::needless_borrow)]
fn save_failable(&self) -> Result<()> {
let dir = Self::options_file(&self.repo)?;