Skip to content

Commit e08d954

Browse files
authored
Clean up a few #[allow]s (#2614)
1 parent 0e37671 commit e08d954

File tree

10 files changed

+13
-29
lines changed

10 files changed

+13
-29
lines changed

Diff for: asyncgit/src/error.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
2-
31
use std::{
42
num::TryFromIntError, path::StripPrefixError,
53
string::FromUtf8Error,

Diff for: asyncgit/src/sync/config.rs

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

Diff for: asyncgit/src/sync/logwalker.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(dead_code)]
21
use super::{CommitId, SharedCommitFilterFn};
32
use crate::error::Result;
43
use git2::{Commit, Oid, Repository};

Diff for: asyncgit/src/sync/patches.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ use super::diff::{get_diff_raw, DiffOptions, HunkHeader};
22
use crate::error::{Error, Result};
33
use git2::{Diff, DiffLine, Patch, Repository};
44

5-
#[allow(clippy::redundant_pub_crate)]
6-
pub(crate) struct HunkLines<'a> {
5+
pub struct HunkLines<'a> {
76
pub hunk: HunkHeader,
87
pub lines: Vec<DiffLine<'a>>,
98
}
109

11-
#[allow(clippy::redundant_pub_crate)]
12-
pub(crate) fn get_file_diff_patch<'a>(
10+
pub fn get_file_diff_patch<'a>(
1311
repo: &'a Repository,
1412
file: &str,
1513
is_staged: bool,

Diff for: asyncgit/src/sync/staging/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ impl NewFromOldContent {
6868
}
6969
}
7070

71-
// this is the heart of the per line discard,stage,unstage. heavily inspired by the great work in nodegit: https://github.com/nodegit/nodegit
72-
#[allow(clippy::redundant_pub_crate)]
73-
pub(crate) fn apply_selection(
71+
// this is the heart of the per line discard,stage,unstage. heavily inspired by the great work in
72+
// nodegit: https://github.com/nodegit/nodegit
73+
pub fn apply_selection(
7474
lines: &[DiffLinePosition],
7575
hunks: &[HunkLines],
7676
old_lines: &[&str],

Diff for: filetreelist/src/error.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
2-
31
use std::{num::TryFromIntError, path::PathBuf};
42
use thiserror::Error;
53

Diff for: filetreelist/src/filetreeitems.rs

-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ impl FileTreeItems {
144144
let item_path =
145145
Path::new(item.info().full_path_str());
146146

147-
//TODO: fix once FP in clippy is fixed
148-
#[allow(clippy::needless_borrow)]
149147
if item_path.starts_with(&path) {
150148
item.hide();
151149
} else {

Diff for: src/components/utils/emoji.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ static EMOJI_REPLACER: Lazy<gh_emoji::Replacer> =
77
// Replace markdown emojis with Unicode equivalent
88
// :hammer: --> 🔨
99
#[inline]
10-
pub fn emojifi_string(s: &mut String) {
11-
let resulting_cow = EMOJI_REPLACER.replace_all(s);
12-
if let Cow::Owned(altered_s) = resulting_cow {
13-
*s = altered_s;
10+
pub fn emojifi_string(s: String) -> String {
11+
if let Cow::Owned(altered_s) = EMOJI_REPLACER.replace_all(&s) {
12+
altered_s
13+
} else {
14+
s
1415
}
1516
}

Diff for: src/components/utils/logitems.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ impl From<CommitInfo> for LogEntry {
4141
};
4242

4343
let author = c.author;
44-
#[allow(unused_mut)]
45-
let mut msg = c.message;
44+
let msg = c.message;
4645

4746
// Replace markdown emojis with Unicode equivalent
4847
#[cfg(feature = "ghemoji")]
49-
emojifi_string(&mut msg);
48+
let msg = emojifi_string(msg);
5049

5150
Self {
5251
author: author.into(),
@@ -175,9 +174,7 @@ mod tests {
175174
use super::*;
176175

177176
fn test_conversion(s: &str) -> String {
178-
let mut s = s.to_string();
179-
emojifi_string(&mut s);
180-
s
177+
emojifi_string(s.into())
181178
}
182179

183180
#[test]

Diff for: src/options.rs

-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ impl Options {
152152
Ok(from_bytes(&buffer)?)
153153
}
154154

155-
//TODO: fix once FP in clippy is fixed
156-
#[allow(clippy::needless_borrow)]
157155
fn save_failable(&self) -> Result<()> {
158156
let dir = Self::options_file(&self.repo)?;
159157

0 commit comments

Comments
 (0)