Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy 1.83 #1918

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ansi/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<'a> AnsiElementIterator<'a> {
}
}

impl<'a> Iterator for AnsiElementIterator<'a> {
impl Iterator for AnsiElementIterator<'_> {
type Item = Element;

fn next(&mut self) -> Option<Element> {
Expand Down Expand Up @@ -126,7 +126,7 @@ impl anstyle_parse::Perform for Performer {
return;
}

let is_sgr = byte == b'm' && intermediates.first().is_none();
let is_sgr = byte == b'm' && intermediates.is_empty();
let element = if is_sgr {
if params.is_empty() {
// Attr::Reset
Expand Down
4 changes: 2 additions & 2 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub type FormatStringPlaceholderData<'a> =

pub type FormatStringSimple = FormatStringPlaceholderDataAnyPlaceholder<()>;

impl<'a> FormatStringPlaceholderData<'a> {
impl FormatStringPlaceholderData<'_> {
pub fn width(&self, hunk_max_line_number_width: usize) -> (usize, usize) {
// Only if Some(placeholder) is present will there be a number formatted
// by this placeholder, if not width is also None.
Expand Down Expand Up @@ -246,7 +246,7 @@ impl CenterRightNumbers for String {
}
}

impl<'a> CenterRightNumbers for &std::borrow::Cow<'a, str> {
impl CenterRightNumbers for &std::borrow::Cow<'_, str> {
fn center_right_space(&self, alignment: Align, width: usize) -> &'static str {
self.as_ref().center_right_space(alignment, width)
}
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub enum BlameLineNumbers {
Every(usize, FormatStringSimple),
}

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
/// If this is a line of git blame output then render it accordingly. If
/// this is the first blame line, then set the syntax-highlighter language
/// according to delta.default-language.
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/commit_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::draw;
use crate::delta::{State, StateMachine};
use crate::features;

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_commit_meta_header_line(&self) -> bool {
self.config.commit_regex.is_match(&self.line)
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/diff_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub enum FileEvent {
NoEvent,
}

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
/// Check for the old mode|new mode lines and cache their info for later use.
pub fn handle_diff_header_mode_line(&mut self) -> std::io::Result<bool> {
let mut handled_line = false;
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/diff_header_diff.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::delta::{DiffType, InMergeConflict, MergeParents, State, StateMachine};
use crate::handlers::diff_header::{get_repeated_file_path_from_diff_line, FileEvent};

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_diff_header_diff_line(&self) -> bool {
self.line.starts_with("diff ")
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/diff_header_misc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::delta::{DiffType, Source, State, StateMachine};
use crate::utils::path::relativize_path_maybe;

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_diff_file_missing(&self) -> bool {
self.source == Source::DiffUnified && self.line.starts_with("Only in ")
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/diff_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::delta::{State, StateMachine};
use crate::features;
use crate::utils;

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_diff_stat_line(&self) -> bool {
(self.state == State::CommitMeta || self.state == State::Unknown)
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/git_show_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::delta::{State, StateMachine};
use crate::paint::{BgShouldFill, StyleSectionSpecifier};
use crate::utils::process;

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
// If this is a line of `git show $revision:/path/to/file.ext` output then
// syntax-highlight it as language `ext`.
pub fn handle_git_show_file_line(&mut self) -> std::io::Result<bool> {
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/grep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct GrepLine<'b> {
pub submatches: Option<Vec<(usize, usize)>>,
}

impl<'b> GrepLine<'b> {
impl GrepLine<'_> {
fn expand_tabs(&mut self, tab_cfg: &tabs::TabCfg) {
let old_len = self.code.len();
self.code = tabs::expand(&self.code, tab_cfg).into();
Expand Down Expand Up @@ -79,7 +79,7 @@ impl LineType {
}
}

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
// If this is a line of grep output then render it accordingly.
pub fn handle_grep_line(&mut self) -> std::io::Result<bool> {
self.painter.emit()?;
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/hunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn compute_is_word_diff() -> bool {
}
}

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_hunk_line(&self) -> bool {
matches!(
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/hunk_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl AmbiguousDiffMinusCounter {
}
}

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_hunk_header_line(&self) -> bool {
self.line.starts_with("@@") &&
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/merge_conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub type MergeConflictLines = MergeConflictCommits<Vec<(String, State)>>;

pub type MergeConflictCommitNames = MergeConflictCommits<Option<String>>;

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
pub fn handle_merge_conflict_line(&mut self) -> std::io::Result<bool> {
use DiffType::*;
use MergeConflictCommit::*;
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod submodule;

use crate::delta::{State, StateMachine};

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
pub fn handle_additional_cases(&mut self, to_state: State) -> std::io::Result<bool> {
let mut handled_line = false;

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/submodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use regex::Regex;

use crate::delta::{State, StateMachine};

impl<'a> StateMachine<'a> {
impl StateMachine<'_> {
#[inline]
fn test_submodule_log(&self) -> bool {
self.line.starts_with("Submodule ")
Expand Down
3 changes: 3 additions & 0 deletions src/subcommands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ pub fn diff(
eprintln!("Failed to execute the command '{diff_bin}': {err}");
return config.error_exit_code;
}
// 1.83 false positive, see rust-lang/rust-clippy/issues/13748
#[allow(unknown_lints)]
#[allow(clippy::zombie_processes)]
let mut diff_process = diff_process.unwrap();

if let Err(error) = delta::delta(
Expand Down