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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 13 additions and 29 deletions

View file

@ -1,5 +1,3 @@
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
use std::{
num::TryFromIntError, path::StripPrefixError,
string::FromUtf8Error,

View file

@ -1,6 +1,3 @@
//TODO: hopefully released in next rust (see https://github.com/rust-lang/rust-clippy/issues/9440)
#![allow(clippy::use_self)]
use crate::error::Result;
use git2::Repository;
use scopetime::scope_time;

View file

@ -1,4 +1,3 @@
#![allow(dead_code)]
use super::{CommitId, SharedCommitFilterFn};
use crate::error::Result;
use git2::{Commit, Oid, Repository};

View file

@ -2,14 +2,12 @@ use super::diff::{get_diff_raw, DiffOptions, HunkHeader};
use crate::error::{Error, Result};
use git2::{Diff, DiffLine, Patch, Repository};
#[allow(clippy::redundant_pub_crate)]
pub(crate) struct HunkLines<'a> {
pub struct HunkLines<'a> {
pub hunk: HunkHeader,
pub lines: Vec<DiffLine<'a>>,
}
#[allow(clippy::redundant_pub_crate)]
pub(crate) fn get_file_diff_patch<'a>(
pub fn get_file_diff_patch<'a>(
repo: &'a Repository,
file: &str,
is_staged: bool,

View file

@ -68,9 +68,9 @@ impl NewFromOldContent {
}
}
// this is the heart of the per line discard,stage,unstage. heavily inspired by the great work in nodegit: https://github.com/nodegit/nodegit
#[allow(clippy::redundant_pub_crate)]
pub(crate) fn apply_selection(
// this is the heart of the per line discard,stage,unstage. heavily inspired by the great work in
// nodegit: https://github.com/nodegit/nodegit
pub fn apply_selection(
lines: &[DiffLinePosition],
hunks: &[HunkLines],
old_lines: &[&str],

View file

@ -1,5 +1,3 @@
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
use std::{num::TryFromIntError, path::PathBuf};
use thiserror::Error;

View file

@ -144,8 +144,6 @@ impl FileTreeItems {
let item_path =
Path::new(item.info().full_path_str());
//TODO: fix once FP in clippy is fixed
#[allow(clippy::needless_borrow)]
if item_path.starts_with(&path) {
item.hide();
} else {

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
}
}

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]

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)?;