summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2020-02-28 10:27:06 +0100
committersharkdp <davidpeter@web.de>2020-02-28 10:27:06 +0100
commitca066bf7cd9919816c47c8c0dc28f16c61766889 (patch)
tree08da881f90a8d37a18f1c2a1629efa53e4abac32
parent4ac3161c19a234b81a7e6657ccae011413c75451 (diff)
Run 'cargo fmt'
-rw-r--r--src/bin/bat/main.rs2
-rw-r--r--src/diff.rs2
-rw-r--r--src/inputfile.rs5
-rw-r--r--src/line_range.rs9
-rw-r--r--src/printer.rs6
-rw-r--r--tests/integration_tests.rs6
6 files changed, 19 insertions, 11 deletions
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index 33bd3b3c..17138d05 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -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;
diff --git a/src/diff.rs b/src/diff.rs
index c6113166..bf0c1f30 100644
--- a/src/diff.rs
+++ b/src/diff.rs
@@ -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};
diff --git a/src/inputfile.rs b/src/inputfile.rs
index 2db2bd1a..e79c931d 100644
--- a/src/inputfile.rs
+++ b/src/inputfile.rs
@@ -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());
diff --git a/src/line_range.rs b/src/line_range.rs
index 9e656cb2..5dfbd3b3 100644
--- a/src/line_range.rs
+++ b/src/line_range.rs
@@ -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(),
+ ),
}
}
diff --git a/src/printer.rs b/src/printer.rs
index cf5b7987..71cbf028 100644
--- a/src/printer.rs
+++ b/src/printer.rs
@@ -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(),
};
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index acc2f738..fcb5b7c7 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -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]