mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
Clean up a few #[allow]s (#2614)
This commit is contained in:
parent
0e3767102a
commit
e08d954573
10 changed files with 13 additions and 29 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
num::TryFromIntError, path::StripPrefixError,
|
num::TryFromIntError, path::StripPrefixError,
|
||||||
string::FromUtf8Error,
|
string::FromUtf8Error,
|
||||||
|
|
|
||||||
|
|
@ -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 crate::error::Result;
|
||||||
use git2::Repository;
|
use git2::Repository;
|
||||||
use scopetime::scope_time;
|
use scopetime::scope_time;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#![allow(dead_code)]
|
|
||||||
use super::{CommitId, SharedCommitFilterFn};
|
use super::{CommitId, SharedCommitFilterFn};
|
||||||
use crate::error::Result;
|
use crate::error::Result;
|
||||||
use git2::{Commit, Oid, Repository};
|
use git2::{Commit, Oid, Repository};
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,12 @@ use super::diff::{get_diff_raw, DiffOptions, HunkHeader};
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use git2::{Diff, DiffLine, Patch, Repository};
|
use git2::{Diff, DiffLine, Patch, Repository};
|
||||||
|
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
pub struct HunkLines<'a> {
|
||||||
pub(crate) struct HunkLines<'a> {
|
|
||||||
pub hunk: HunkHeader,
|
pub hunk: HunkHeader,
|
||||||
pub lines: Vec<DiffLine<'a>>,
|
pub lines: Vec<DiffLine<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
pub fn get_file_diff_patch<'a>(
|
||||||
pub(crate) fn get_file_diff_patch<'a>(
|
|
||||||
repo: &'a Repository,
|
repo: &'a Repository,
|
||||||
file: &str,
|
file: &str,
|
||||||
is_staged: bool,
|
is_staged: bool,
|
||||||
|
|
|
||||||
|
|
@ -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
|
// this is the heart of the per line discard,stage,unstage. heavily inspired by the great work in
|
||||||
#[allow(clippy::redundant_pub_crate)]
|
// nodegit: https://github.com/nodegit/nodegit
|
||||||
pub(crate) fn apply_selection(
|
pub fn apply_selection(
|
||||||
lines: &[DiffLinePosition],
|
lines: &[DiffLinePosition],
|
||||||
hunks: &[HunkLines],
|
hunks: &[HunkLines],
|
||||||
old_lines: &[&str],
|
old_lines: &[&str],
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(renamed_and_removed_lints, clippy::unknown_clippy_lints)]
|
|
||||||
|
|
||||||
use std::{num::TryFromIntError, path::PathBuf};
|
use std::{num::TryFromIntError, path::PathBuf};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,6 @@ impl FileTreeItems {
|
||||||
let item_path =
|
let item_path =
|
||||||
Path::new(item.info().full_path_str());
|
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) {
|
if item_path.starts_with(&path) {
|
||||||
item.hide();
|
item.hide();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,10 @@ static EMOJI_REPLACER: Lazy<gh_emoji::Replacer> =
|
||||||
// Replace markdown emojis with Unicode equivalent
|
// Replace markdown emojis with Unicode equivalent
|
||||||
// :hammer: --> 🔨
|
// :hammer: --> 🔨
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn emojifi_string(s: &mut String) {
|
pub fn emojifi_string(s: String) -> String {
|
||||||
let resulting_cow = EMOJI_REPLACER.replace_all(s);
|
if let Cow::Owned(altered_s) = EMOJI_REPLACER.replace_all(&s) {
|
||||||
if let Cow::Owned(altered_s) = resulting_cow {
|
altered_s
|
||||||
*s = altered_s;
|
} else {
|
||||||
|
s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,12 +41,11 @@ impl From<CommitInfo> for LogEntry {
|
||||||
};
|
};
|
||||||
|
|
||||||
let author = c.author;
|
let author = c.author;
|
||||||
#[allow(unused_mut)]
|
let msg = c.message;
|
||||||
let mut msg = c.message;
|
|
||||||
|
|
||||||
// Replace markdown emojis with Unicode equivalent
|
// Replace markdown emojis with Unicode equivalent
|
||||||
#[cfg(feature = "ghemoji")]
|
#[cfg(feature = "ghemoji")]
|
||||||
emojifi_string(&mut msg);
|
let msg = emojifi_string(msg);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
author: author.into(),
|
author: author.into(),
|
||||||
|
|
@ -175,9 +174,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn test_conversion(s: &str) -> String {
|
fn test_conversion(s: &str) -> String {
|
||||||
let mut s = s.to_string();
|
emojifi_string(s.into())
|
||||||
emojifi_string(&mut s);
|
|
||||||
s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -152,8 +152,6 @@ impl Options {
|
||||||
Ok(from_bytes(&buffer)?)
|
Ok(from_bytes(&buffer)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: fix once FP in clippy is fixed
|
|
||||||
#[allow(clippy::needless_borrow)]
|
|
||||||
fn save_failable(&self) -> Result<()> {
|
fn save_failable(&self) -> Result<()> {
|
||||||
let dir = Self::options_file(&self.repo)?;
|
let dir = Self::options_file(&self.repo)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue