From 62696f5819bd27489664bcb320e1e0b422e22e60 Mon Sep 17 00:00:00 2001 From: liv <819880950@qq.com> Date: Wed, 5 Jun 2019 12:18:50 +0200 Subject: Remove highlighting and syntect --- Cargo.toml | 1 - default_out.md | 20 -------------------- default_out.txt | 18 ++++++++++++++++++ src/main.rs | 17 ++--------------- 4 files changed, 20 insertions(+), 36 deletions(-) delete mode 100644 default_out.md create mode 100644 default_out.txt diff --git a/Cargo.toml b/Cargo.toml index 20220a5..069a398 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ edition = "2018" clap = "2.32.0" indicatif = "0.9.0" console = "0.6.2" -syntect = "3.0.2" notify = "4.0.0" toml = "0.4.10" serde = {version = "1.0.10", features = ["derive"]} diff --git a/default_out.md b/default_out.md deleted file mode 100644 index f88969d..0000000 --- a/default_out.md +++ /dev/null @@ -1,20 +0,0 @@ -Thanks for installing `rustlings`! - -## Is this your first time? - -Let's make sure you're up to speed: -- You have Rust installed, preferably via `rustup` -- You have `~/.cargo/bin` added to your PATH variable -- You have cloned this repository (https://github.com/rust-lang/rustlings) -- You have installed Rust language support for your editor -- You have locally installed the `rustlings` command by running: - -```sh -cargo install --path . -``` - -If you've done all of this (or even most of it), congrats! You're ready -to start working with Rust. - -To get started, run `rustlings verify` in order to get the first exercise. -Make sure to have your editor open! diff --git a/default_out.txt b/default_out.txt new file mode 100644 index 0000000..55eaa97 --- /dev/null +++ b/default_out.txt @@ -0,0 +1,18 @@ +Thanks for installing Rustlings! + +Is this your first time? + +Let's make sure you're up to speed: +- You have Rust installed, preferably via `rustup` +- You have `~/.cargo/bin` added to your PATH variable +- You have cloned this repository (https://github.com/rust-lang/rustlings) +- You have installed Rust language support for your editor +- You have locally installed the `rustlings` command by running: + +cargo install --path . + +If you've done all of this (or even most of it), congrats! You're ready +to start working with Rust. + +To get started, run `rustlings verify` in order to get the first exercise. +Make sure to have your editor open! diff --git a/src/main.rs b/src/main.rs index 744888f..85c91b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,14 +6,9 @@ use notify::DebouncedEvent; use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use std::ffi::OsStr; use std::fs; -use std::io::BufRead; use std::path::Path; use std::sync::mpsc::channel; use std::time::Duration; -use syntect::easy::HighlightFile; -use syntect::highlighting::{Style, ThemeSet}; -use syntect::parsing::SyntaxSet; -use syntect::util::as_24_bit_terminal_escaped; mod exercise; mod run; @@ -35,9 +30,6 @@ fn main() { ) .get_matches(); - let ss = SyntaxSet::load_defaults_newlines(); - let ts = ThemeSet::load_defaults(); - if None == matches.subcommand_name() { println!(); println!(r#" welcome to... "#); @@ -92,13 +84,8 @@ fn main() { } if matches.subcommand_name().is_none() { - let mut highlighter = - HighlightFile::new("default_out.md", &ss, &ts.themes["base16-eighties.dark"]).unwrap(); - for maybe_line in highlighter.reader.lines() { - let line = maybe_line.unwrap(); - let regions: Vec<(Style, &str)> = highlighter.highlight_lines.highlight(&line, &ss); - println!("{}", as_24_bit_terminal_escaped(®ions[..], true)); - } + let text = fs::read_to_string("default_out.txt").unwrap(); + println!("{}", text); } println!("\x1b[0m"); -- cgit v1.2.3