mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-15 04:14:15 +01:00
Run 'cargo fmt'
This commit is contained in:
parent
4ac3161c19
commit
ca066bf7cd
@ -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(),
|
||||
};
|
||||
|
||||
|
@ -494,7 +494,8 @@ fn unicode_wrap() {
|
||||
.arg("--terminal-width=40")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(" 1 ビタミンA ビタミンD ビタミンE ビ
|
||||
.stdout(
|
||||
" 1 ビタミンA ビタミンD ビタミンE ビ
|
||||
タミンK ビタミンB1 ビタミンB2 ナ
|
||||
イアシン パントテン酸 ビタミンB6
|
||||
ビタミンB12 葉酸 ビオチン ビタ
|
||||
@ -522,7 +523,8 @@ fn unicode_wrap() {
|
||||
дерланды Австрия Польша Португалия
|
||||
Румыния Словения Словакия Финляндия
|
||||
Швеция Великобритания
|
||||
");
|
||||
",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user