mirror of
https://github.com/sharkdp/bat
synced 2024-11-18 15:26:16 +00:00
Merge pull request #2502 from Enselic/clippy-1.68
Fix clippy warnings with Rust 1.68
This commit is contained in:
commit
231ad86f04
@ -575,7 +575,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
|||||||
)
|
)
|
||||||
.group(
|
.group(
|
||||||
ArgGroup::new("cache-actions")
|
ArgGroup::new("cache-actions")
|
||||||
.args(&["build", "clear"])
|
.args(["build", "clear"])
|
||||||
.required(true),
|
.required(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -17,11 +17,11 @@ pub enum LineChange {
|
|||||||
pub type LineChanges = HashMap<u32, LineChange>;
|
pub type LineChanges = HashMap<u32, LineChange>;
|
||||||
|
|
||||||
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
||||||
let repo = Repository::discover(&filename).ok()?;
|
let repo = Repository::discover(filename).ok()?;
|
||||||
|
|
||||||
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||||
|
|
||||||
let filepath_absolute = fs::canonicalize(&filename).ok()?;
|
let filepath_absolute = fs::canonicalize(filename).ok()?;
|
||||||
let filepath_relative_to_repo = filepath_absolute.strip_prefix(&repo_path_absolute).ok()?;
|
let filepath_relative_to_repo = filepath_absolute.strip_prefix(&repo_path_absolute).ok()?;
|
||||||
|
|
||||||
let mut diff_options = DiffOptions::new();
|
let mut diff_options = DiffOptions::new();
|
||||||
|
@ -22,7 +22,7 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String {
|
|||||||
// Add tab.
|
// Add tab.
|
||||||
let spaces = width - (*cursor % width);
|
let spaces = width - (*cursor % width);
|
||||||
*cursor += spaces;
|
*cursor += spaces;
|
||||||
buffer.push_str(&*" ".repeat(spaces));
|
buffer.push_str(&" ".repeat(spaces));
|
||||||
|
|
||||||
// Next.
|
// Next.
|
||||||
text = &text[index + 1..text.len()];
|
text = &text[index + 1..text.len()];
|
||||||
|
@ -629,7 +629,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
"{}\n{}",
|
"{}\n{}",
|
||||||
as_terminal_escaped(
|
as_terminal_escaped(
|
||||||
style,
|
style,
|
||||||
&*format!("{}{}", self.ansi_style, line_buf),
|
&format!("{}{}", self.ansi_style, line_buf),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.use_italic_text,
|
self.config.use_italic_text,
|
||||||
@ -655,7 +655,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
"{}",
|
"{}",
|
||||||
as_terminal_escaped(
|
as_terminal_escaped(
|
||||||
style,
|
style,
|
||||||
&*format!("{}{}", self.ansi_style, line_buf),
|
&format!("{}{}", self.ansi_style, line_buf),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.use_italic_text,
|
self.config.use_italic_text,
|
||||||
|
Loading…
Reference in New Issue
Block a user