mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 19:02:22 +01:00
Run 'cargo fmt'
This commit is contained in:
@@ -9,11 +9,11 @@ mod clap_app;
|
||||
mod config;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
use ansi_term::Colour::Green;
|
||||
use ansi_term::Style;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
use git2::{DiffOptions, IntoCString, Repository};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader};
|
||||
use std::ffi::OsStr;
|
||||
|
||||
use content_inspector::{self, ContentType};
|
||||
|
||||
@@ -64,7 +64,8 @@ impl<'a> InputFile<'a> {
|
||||
match self {
|
||||
InputFile::StdIn => Ok(InputFileReader::new(stdin.lock())),
|
||||
InputFile::Ordinary(filename) => {
|
||||
let file = File::open(filename).map_err(|e| format!("'{}': {}", filename.to_string_lossy(), e))?;
|
||||
let file = File::open(filename)
|
||||
.map_err(|e| format!("'{}': {}", filename.to_string_lossy(), e))?;
|
||||
|
||||
if file.metadata()?.is_dir() {
|
||||
return Err(format!("'{}' is a directory.", filename.to_string_lossy()).into());
|
||||
|
@@ -35,13 +35,16 @@ impl LineRange {
|
||||
new_range.lower = line_numbers[0].parse()?;
|
||||
new_range.upper = new_range.lower;
|
||||
Ok(new_range)
|
||||
},
|
||||
}
|
||||
2 => {
|
||||
new_range.lower = line_numbers[0].parse()?;
|
||||
new_range.upper = line_numbers[1].parse()?;
|
||||
Ok(new_range)
|
||||
},
|
||||
_ => Err("Line range contained more than one ':' character. Expected format: 'N' or 'N:M'".into()),
|
||||
}
|
||||
_ => Err(
|
||||
"Line range contained more than one ':' character. Expected format: 'N' or 'N:M'"
|
||||
.into(),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use std::borrow::Cow;
|
||||
use std::io::Write;
|
||||
use std::vec::Vec;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use ansi_term::Colour::{Fixed, Green, Red, Yellow};
|
||||
use ansi_term::Style;
|
||||
@@ -228,7 +228,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
if !self.config.output_components.header() {
|
||||
if Some(ContentType::BINARY) == self.content_type && !self.config.show_nonprintable {
|
||||
let input = match file {
|
||||
InputFile::Ordinary(filename) => format!("file '{}'", filename.to_string_lossy()),
|
||||
InputFile::Ordinary(filename) => {
|
||||
format!("file '{}'", filename.to_string_lossy())
|
||||
}
|
||||
_ => "STDIN".into(),
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user