on master help sign in
Migrated to Rust 2018
commita21ae614e667fdea9dac64548df9985113c354dd authorDaniele Esposti <daniele.esposti@gmail.com> dateFri 8 Mar 2019, 10:48 (8 years ago) parentb94c94e
14 files changed+49−48
Cargo.toml+1 src/app.rs+9−9 src/assets.rs+4−4 src/config.rs+2−2 src/controller.rs+7−7 src/decorations.rs+2−2 src/dirs.rs+1−1 src/inputfile.rs+1−1 src/line_range.rs+1−1 src/main.rs+7−7 src/output.rs+2−2 src/printer.rs+10−10 src/style.rs+1−1 tests/snapshot_tests.rs+1−1
Cargo.toml+1
@@ -13,6 +13,7 @@ exclude = [
1313 "assets/themes/*",
1414]
1515build = "build.rs"
16+edition = '2018'
1617
1718[dependencies]
1819atty = "0.2.2"
src/app.rs+9−9
@@ -5,7 +5,7 @@ use std::str::FromStr;
55use atty::{self, Stream};
66
77use clap::ArgMatches;
8−use clap_app;
8+use crate::clap_app;
99use wild;
1010
1111use console::Term;
@@ -13,14 +13,14 @@ use console::Term;
1313#[cfg(windows)]
1414use ansi_term;
1515
16−use assets::BAT_THEME_DEFAULT;
17−use config::{get_args_from_config_file, get_args_from_env_var};
18−use errors::*;
19−use inputfile::InputFile;
20−use line_range::{LineRange, LineRanges};
21−use style::{OutputComponent, OutputComponents, OutputWrap};
22−use syntax_mapping::SyntaxMapping;
23−use util::transpose;
16+use crate::assets::BAT_THEME_DEFAULT;
17+use crate::config::{get_args_from_config_file, get_args_from_env_var};
18+use crate::errors::*;
19+use crate::inputfile::InputFile;
20+use crate::line_range::{LineRange, LineRanges};
21+use crate::style::{OutputComponent, OutputComponents, OutputWrap};
22+use crate::syntax_mapping::SyntaxMapping;
23+use crate::util::transpose;
2424
2525#[derive(Debug, Clone, Copy, PartialEq)]
2626pub enum PagingMode {
src/assets.rs+4−4
@@ -8,11 +8,11 @@ use syntect::dumps::{dump_to_file, from_binary, from_reader};
88use syntect::highlighting::{Theme, ThemeSet};
99use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
1010
11−use dirs::PROJECT_DIRS;
11+use crate::dirs::PROJECT_DIRS;
1212
13−use errors::*;
14−use inputfile::{InputFile, InputFileReader};
15−use syntax_mapping::SyntaxMapping;
13+use crate::errors::*;
14+use crate::inputfile::{InputFile, InputFileReader};
15+use crate::syntax_mapping::SyntaxMapping;
1616
1717pub const BAT_THEME_DEFAULT: &str = "Monokai Extended";
1818
src/config.rs+2−2
@@ -5,8 +5,8 @@ use std::path::PathBuf;
55
66use shell_words;
77
8−use dirs::PROJECT_DIRS;
9−use util::transpose;
8+use crate::dirs::PROJECT_DIRS;
9+use crate::util::transpose;
1010
1111pub fn config_file() -> PathBuf {
1212 env::var("BAT_CONFIG_PATH")
src/controller.rs+7−7
@@ -1,13 +1,13 @@
11use std::io::{self, Write};
22use std::path::Path;
33
4−use app::{Config, PagingMode};
5−use assets::HighlightingAssets;
6−use errors::*;
7−use inputfile::{InputFile, InputFileReader};
8−use line_range::{LineRanges, RangeCheckResult};
9−use output::OutputType;
10−use printer::{InteractivePrinter, Printer, SimplePrinter};
4+use crate::app::{Config, PagingMode};
5+use crate::assets::HighlightingAssets;
6+use crate::errors::*;
7+use crate::inputfile::{InputFile, InputFileReader};
8+use crate::line_range::{LineRanges, RangeCheckResult};
9+use crate::output::OutputType;
10+use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
1111
1212pub struct Controller<'a> {
1313 config: &'a Config<'a>,
src/decorations.rs+2−2
@@ -1,6 +1,6 @@
11use ansi_term::Style;
2−use diff::LineChange;
3−use printer::{Colors, InteractivePrinter};
2+use crate::diff::LineChange;
3+use crate::printer::{Colors, InteractivePrinter};
44
55#[derive(Clone)]
66pub struct DecorationText {
src/dirs.rs+1−1
@@ -1,4 +1,4 @@
1−use dirs_rs;
1+use crate::dirs_rs;
22use std::path::{Path, PathBuf};
33
44#[cfg(target_os = "macos")]
src/inputfile.rs+1−1
@@ -3,7 +3,7 @@ use std::io::{self, BufRead, BufReader};
33
44use content_inspector::{self, ContentType};
55
6−use errors::*;
6+use crate::errors::*;
77
88const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
99
src/line_range.rs+1−1
@@ -1,4 +1,4 @@
1−use errors::*;
1+use crate::errors::*;
22
33#[derive(Clone)]
44pub struct LineRange {
src/main.rs+7−7
@@ -48,12 +48,12 @@ use std::process;
4848use ansi_term::Colour::Green;
4949use ansi_term::Style;
5050
51−use app::{App, Config};
52−use assets::{cache_dir, clear_assets, config_dir, HighlightingAssets};
53−use config::config_file;
54−use controller::Controller;
55−use inputfile::InputFile;
56−use style::{OutputComponent, OutputComponents};
51+use crate::app::{App, Config};
52+use crate::assets::{cache_dir, clear_assets, config_dir, HighlightingAssets};
53+use crate::config::config_file;
54+use crate::controller::Controller;
55+use crate::inputfile::InputFile;
56+use crate::style::{OutputComponent, OutputComponents};
5757
5858mod errors {
5959 error_chain! {
@@ -80,7 +80,7 @@ mod errors {
8080 }
8181}
8282
83−use errors::*;
83+use crate::errors::*;
8484
8585fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
8686 if matches.is_present("build") {
src/output.rs+2−2
@@ -6,8 +6,8 @@ use std::process::{Child, Command, Stdio};
66
77use shell_words;
88
9−use app::PagingMode;
10−use errors::*;
9+use crate::app::PagingMode;
10+use crate::errors::*;
1111
1212pub enum OutputType {
1313 Pager(Child),
src/printer.rs+10−10
@@ -16,16 +16,16 @@ use content_inspector::ContentType;
1616use encoding::all::{UTF_16BE, UTF_16LE};
1717use encoding::{DecoderTrap, Encoding};
1818
19−use app::Config;
20−use assets::HighlightingAssets;
21−use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
22−use diff::get_git_diff;
23−use diff::LineChanges;
24−use errors::*;
25−use inputfile::{InputFile, InputFileReader};
26−use preprocessor::{expand_tabs, replace_nonprintable};
27−use style::OutputWrap;
28−use terminal::{as_terminal_escaped, to_ansi_color};
19+use crate::app::Config;
20+use crate::assets::HighlightingAssets;
21+use crate::decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
22+use crate::diff::get_git_diff;
23+use crate::diff::LineChanges;
24+use crate::errors::*;
25+use crate::inputfile::{InputFile, InputFileReader};
26+use crate::preprocessor::{expand_tabs, replace_nonprintable};
27+use crate::style::OutputWrap;
28+use crate::terminal::{as_terminal_escaped, to_ansi_color};
2929
3030pub trait Printer {
3131 fn print_header(&mut self, handle: &mut Write, file: InputFile) -> Result<()>;
src/style.rs+1−1
@@ -1,7 +1,7 @@
11use std::collections::HashSet;
22use std::str::FromStr;
33
4−use errors::*;
4+use crate::errors::*;
55
66#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
77pub enum OutputComponent {
tests/snapshot_tests.rs+1−1
@@ -1,6 +1,6 @@
11mod tester;
22
3−use tester::BatTester;
3+use crate::tester::BatTester;
44
55macro_rules! snapshot_tests {
66 ($($test_name: ident: $style: expr,)*) => {