Skip to content

Commit

Permalink
Formatted with newer cargo fmt.
Browse files Browse the repository at this point in the history
It should pass all the checks now.
  • Loading branch information
eth-p authored and sharkdp committed May 16, 2018
1 parent 900f610 commit d569693
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl App {
.use_delimiter(true)
.takes_value(true)
.possible_values(&[
"auto", "full", "plain", "changes", "header", "grid", "numbers"
"auto", "full", "plain", "changes", "header", "grid", "numbers",
])
.default_value("auto")
.help("Additional info to display along with content"),
Expand Down
3 changes: 2 additions & 1 deletion src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
diff_options.pathspec(pathspec);
diff_options.context_lines(0);

let diff = repo.diff_index_to_workdir(None, Some(&mut diff_options))
let diff = repo
.diff_index_to_workdir(None, Some(&mut diff_options))
.ok()?;

let mut line_changes: LineChanges = HashMap::new();
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ extern crate syntect;

mod app;
mod assets;
mod decorations;
mod diff;
mod printer;
mod style;
mod terminal;
mod decorations;

use std::fs::{self, File};
use std::io::{self, BufRead, BufReader, Write};
Expand Down
13 changes: 8 additions & 5 deletions src/printer.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use app::Config;
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
use diff::LineChanges;
use errors::*;
use std::boxed::Box;
use std::io::Write;
use std::vec::Vec;
use std::boxed::Box;
use style::OutputWrap;
use syntect::highlighting;
use terminal::as_terminal_escaped;
use style::OutputWrap;
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
use Colors;

pub struct Printer<'a> {
Expand Down Expand Up @@ -50,7 +50,9 @@ impl<'a> Printer<'a> {

// Disable the panel if the terminal is too small (i.e. can't fit 5 characters with the
// panel showing).
if config.term_width < (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5 {
if config.term_width
< (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5
{
decorations.clear();
panel_width = 0;
}
Expand Down Expand Up @@ -117,7 +119,8 @@ impl<'a> Printer<'a> {

// Line decorations.
if self.panel_width > 0 {
let decorations = self.decorations
let decorations = self
.decorations
.iter()
.map(|ref d| d.generate(line_number, false, self))
.collect::<Vec<_>>();
Expand Down
5 changes: 1 addition & 4 deletions tests/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ impl BatTester {

pub fn test_snapshot(&self, style: &str) {
let output = Command::new(&self.exe)
.args(&[
"tests/snapshots/sample.rs",
&format!("--style={}", style),
])
.args(&["tests/snapshots/sample.rs", &format!("--style={}", style)])
.output()
.expect("bat failed");
// have to do the replace because the filename in the header changes based on the current working directory
Expand Down

0 comments on commit d569693

Please sign in to comment.