on master help sign in
Formatted with newer cargo fmt.

It should pass all the checks now.

commitd569693dab51d95e5e49be25435df2c4ba64ef37 authoreth-p <32112321+eth-p@users.noreply.github.com> dateTue 15 May 2018, 17:45 (8 years ago) parent900f610
5 files changed+13−12
src/app.rs+1−1 src/diff.rs+2−1 src/main.rs+1−1 src/printer.rs+8−5 tests/tester.rs+1−4
src/app.rs+1−1
@@ -59,7 +59,7 @@ impl App {
5959 .use_delimiter(true)
6060 .takes_value(true)
6161 .possible_values(&[
62− "auto", "full", "plain", "changes", "header", "grid", "numbers"
62+ "auto", "full", "plain", "changes", "header", "grid", "numbers",
6363 ])
6464 .default_value("auto")
6565 .help("Additional info to display along with content"),
src/diff.rs+2−1
@@ -23,7 +23,8 @@ pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
2323 diff_options.pathspec(pathspec);
2424 diff_options.context_lines(0);
2525
26− let diff = repo.diff_index_to_workdir(None, Some(&mut diff_options))
26+ let diff = repo
27+ .diff_index_to_workdir(None, Some(&mut diff_options))
2728 .ok()?;
2829
2930 let mut line_changes: LineChanges = HashMap::new();
src/main.rs+1−1
@@ -19,11 +19,11 @@ extern crate syntect;
1919
2020mod app;
2121mod assets;
22+mod decorations;
2223mod diff;
2324mod printer;
2425mod style;
2526mod terminal;
26−mod decorations;
2727
2828use std::fs::{self, File};
2929use std::io::{self, BufRead, BufReader, Write};
src/printer.rs+8−5
@@ -1,13 +1,13 @@
11use app::Config;
2+use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
23use diff::LineChanges;
34use errors::*;
5+use std::boxed::Box;
46use std::io::Write;
57use std::vec::Vec;
6−use std::boxed::Box;
8+use style::OutputWrap;
79use syntect::highlighting;
810use terminal::as_terminal_escaped;
9−use style::OutputWrap;
10−use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
1111use Colors;
1212
1313pub struct Printer<'a> {
@@ -50,7 +50,9 @@ impl<'a> Printer<'a> {
5050
5151 // Disable the panel if the terminal is too small (i.e. can't fit 5 characters with the
5252 // panel showing).
53− if config.term_width < (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5 {
53+ if config.term_width
54+ < (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5
55+ {
5456 decorations.clear();
5557 panel_width = 0;
5658 }
@@ -117,7 +119,8 @@ impl<'a> Printer<'a> {
117119
118120 // Line decorations.
119121 if self.panel_width > 0 {
120− let decorations = self.decorations
122+ let decorations = self
123+ .decorations
121124 .iter()
122125 .map(|ref d| d.generate(line_number, false, self))
123126 .collect::<Vec<_>>();
tests/tester.rs+1−4
@@ -29,10 +29,7 @@ impl BatTester {
2929
3030 pub fn test_snapshot(&self, style: &str) {
3131 let output = Command::new(&self.exe)
32− .args(&[
33− "tests/snapshots/sample.rs",
34− &format!("--style={}", style),
35− ])
32+ .args(&["tests/snapshots/sample.rs", &format!("--style={}", style)])
3633 .output()
3734 .expect("bat failed");
3835 // have to do the replace because the filename in the header changes based on the current working directory