Migrated to Rust 2018

This commit is contained in:
Daniele Esposti 2019-03-08 10:48:22 +00:00 committed by David Peter
parent b94c94e845
commit a21ae614e6
14 changed files with 49 additions and 48 deletions

View File

@ -13,6 +13,7 @@ exclude = [
"assets/themes/*",
]
build = "build.rs"
edition = '2018'
[dependencies]
atty = "0.2.2"

View File

@ -5,7 +5,7 @@ use std::str::FromStr;
use atty::{self, Stream};
use clap::ArgMatches;
use clap_app;
use crate::clap_app;
use wild;
use console::Term;
@ -13,14 +13,14 @@ use console::Term;
#[cfg(windows)]
use ansi_term;
use assets::BAT_THEME_DEFAULT;
use config::{get_args_from_config_file, get_args_from_env_var};
use errors::*;
use inputfile::InputFile;
use line_range::{LineRange, LineRanges};
use style::{OutputComponent, OutputComponents, OutputWrap};
use syntax_mapping::SyntaxMapping;
use util::transpose;
use crate::assets::BAT_THEME_DEFAULT;
use crate::config::{get_args_from_config_file, get_args_from_env_var};
use crate::errors::*;
use crate::inputfile::InputFile;
use crate::line_range::{LineRange, LineRanges};
use crate::style::{OutputComponent, OutputComponents, OutputWrap};
use crate::syntax_mapping::SyntaxMapping;
use crate::util::transpose;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum PagingMode {

View File

@ -8,11 +8,11 @@ use syntect::dumps::{dump_to_file, from_binary, from_reader};
use syntect::highlighting::{Theme, ThemeSet};
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
use dirs::PROJECT_DIRS;
use crate::dirs::PROJECT_DIRS;
use errors::*;
use inputfile::{InputFile, InputFileReader};
use syntax_mapping::SyntaxMapping;
use crate::errors::*;
use crate::inputfile::{InputFile, InputFileReader};
use crate::syntax_mapping::SyntaxMapping;
pub const BAT_THEME_DEFAULT: &str = "Monokai Extended";

View File

@ -5,8 +5,8 @@ use std::path::PathBuf;
use shell_words;
use dirs::PROJECT_DIRS;
use util::transpose;
use crate::dirs::PROJECT_DIRS;
use crate::util::transpose;
pub fn config_file() -> PathBuf {
env::var("BAT_CONFIG_PATH")

View File

@ -1,13 +1,13 @@
use std::io::{self, Write};
use std::path::Path;
use app::{Config, PagingMode};
use assets::HighlightingAssets;
use errors::*;
use inputfile::{InputFile, InputFileReader};
use line_range::{LineRanges, RangeCheckResult};
use output::OutputType;
use printer::{InteractivePrinter, Printer, SimplePrinter};
use crate::app::{Config, PagingMode};
use crate::assets::HighlightingAssets;
use crate::errors::*;
use crate::inputfile::{InputFile, InputFileReader};
use crate::line_range::{LineRanges, RangeCheckResult};
use crate::output::OutputType;
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
pub struct Controller<'a> {
config: &'a Config<'a>,

View File

@ -1,6 +1,6 @@
use ansi_term::Style;
use diff::LineChange;
use printer::{Colors, InteractivePrinter};
use crate::diff::LineChange;
use crate::printer::{Colors, InteractivePrinter};
#[derive(Clone)]
pub struct DecorationText {

View File

@ -1,4 +1,4 @@
use dirs_rs;
use crate::dirs_rs;
use std::path::{Path, PathBuf};
#[cfg(target_os = "macos")]

View File

@ -3,7 +3,7 @@ use std::io::{self, BufRead, BufReader};
use content_inspector::{self, ContentType};
use errors::*;
use crate::errors::*;
const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");

View File

@ -1,4 +1,4 @@
use errors::*;
use crate::errors::*;
#[derive(Clone)]
pub struct LineRange {

View File

@ -48,12 +48,12 @@ use std::process;
use ansi_term::Colour::Green;
use ansi_term::Style;
use app::{App, Config};
use assets::{cache_dir, clear_assets, config_dir, HighlightingAssets};
use config::config_file;
use controller::Controller;
use inputfile::InputFile;
use style::{OutputComponent, OutputComponents};
use crate::app::{App, Config};
use crate::assets::{cache_dir, clear_assets, config_dir, HighlightingAssets};
use crate::config::config_file;
use crate::controller::Controller;
use crate::inputfile::InputFile;
use crate::style::{OutputComponent, OutputComponents};
mod errors {
error_chain! {
@ -80,7 +80,7 @@ mod errors {
}
}
use errors::*;
use crate::errors::*;
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
if matches.is_present("build") {

View File

@ -6,8 +6,8 @@ use std::process::{Child, Command, Stdio};
use shell_words;
use app::PagingMode;
use errors::*;
use crate::app::PagingMode;
use crate::errors::*;
pub enum OutputType {
Pager(Child),

View File

@ -16,16 +16,16 @@ use content_inspector::ContentType;
use encoding::all::{UTF_16BE, UTF_16LE};
use encoding::{DecoderTrap, Encoding};
use app::Config;
use assets::HighlightingAssets;
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
use diff::get_git_diff;
use diff::LineChanges;
use errors::*;
use inputfile::{InputFile, InputFileReader};
use preprocessor::{expand_tabs, replace_nonprintable};
use style::OutputWrap;
use terminal::{as_terminal_escaped, to_ansi_color};
use crate::app::Config;
use crate::assets::HighlightingAssets;
use crate::decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
use crate::diff::get_git_diff;
use crate::diff::LineChanges;
use crate::errors::*;
use crate::inputfile::{InputFile, InputFileReader};
use crate::preprocessor::{expand_tabs, replace_nonprintable};
use crate::style::OutputWrap;
use crate::terminal::{as_terminal_escaped, to_ansi_color};
pub trait Printer {
fn print_header(&mut self, handle: &mut Write, file: InputFile) -> Result<()>;

View File

@ -1,7 +1,7 @@
use std::collections::HashSet;
use std::str::FromStr;
use errors::*;
use crate::errors::*;
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
pub enum OutputComponent {

View File

@ -1,6 +1,6 @@
mod tester;
use tester::BatTester;
use crate::tester::BatTester;
macro_rules! snapshot_tests {
($($test_name: ident: $style: expr,)*) => {