Run 'cargo fmt'

pull/847/head
sharkdp 5 years ago
parent 4ac3161c19
commit ca066bf7cd

@ -9,11 +9,11 @@ mod clap_app;
mod config; mod config;
use std::collections::HashSet; use std::collections::HashSet;
use std::ffi::OsStr;
use std::io; use std::io;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use std::process; use std::process;
use std::ffi::OsStr;
use ansi_term::Colour::Green; use ansi_term::Colour::Green;
use ansi_term::Style; use ansi_term::Style;

@ -1,7 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use std::ffi::OsStr;
use git2::{DiffOptions, IntoCString, Repository}; use git2::{DiffOptions, IntoCString, Repository};

@ -1,6 +1,6 @@
use std::ffi::OsStr;
use std::fs::File; use std::fs::File;
use std::io::{self, BufRead, BufReader}; use std::io::{self, BufRead, BufReader};
use std::ffi::OsStr;
use content_inspector::{self, ContentType}; use content_inspector::{self, ContentType};
@ -64,7 +64,8 @@ impl<'a> InputFile<'a> {
match self { match self {
InputFile::StdIn => Ok(InputFileReader::new(stdin.lock())), InputFile::StdIn => Ok(InputFileReader::new(stdin.lock())),
InputFile::Ordinary(filename) => { 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() { if file.metadata()?.is_dir() {
return Err(format!("'{}' is a directory.", filename.to_string_lossy()).into()); 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.lower = line_numbers[0].parse()?;
new_range.upper = new_range.lower; new_range.upper = new_range.lower;
Ok(new_range) Ok(new_range)
}, }
2 => { 2 => {
new_range.lower = line_numbers[0].parse()?; new_range.lower = line_numbers[0].parse()?;
new_range.upper = line_numbers[1].parse()?; new_range.upper = line_numbers[1].parse()?;
Ok(new_range) 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::io::Write;
use std::vec::Vec; use std::vec::Vec;
use std::borrow::Cow;
use ansi_term::Colour::{Fixed, Green, Red, Yellow}; use ansi_term::Colour::{Fixed, Green, Red, Yellow};
use ansi_term::Style; use ansi_term::Style;
@ -228,7 +228,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
if !self.config.output_components.header() { if !self.config.output_components.header() {
if Some(ContentType::BINARY) == self.content_type && !self.config.show_nonprintable { if Some(ContentType::BINARY) == self.content_type && !self.config.show_nonprintable {
let input = match file { let input = match file {
InputFile::Ordinary(filename) => format!("file '{}'", filename.to_string_lossy()), InputFile::Ordinary(filename) => {
format!("file '{}'", filename.to_string_lossy())
}
_ => "STDIN".into(), _ => "STDIN".into(),
}; };

@ -494,7 +494,8 @@ fn unicode_wrap() {
.arg("--terminal-width=40") .arg("--terminal-width=40")
.assert() .assert()
.success() .success()
.stdout(" 1 A D E .stdout(
" 1 A D E
K B1 B2 K B1 B2
B6 B6
B12 B12
@ -522,7 +523,8 @@ fn unicode_wrap() {
дерланды Австрия Польша Португалия дерланды Австрия Польша Португалия
Румыния Словения Словакия Финляндия Румыния Словения Словакия Финляндия
Швеция Великобритания Швеция Великобритания
"); ",
);
} }
#[test] #[test]

Loading…
Cancel
Save