From 62696f5819bd27489664bcb320e1e0b422e22e60 Mon Sep 17 00:00:00 2001 From: liv <819880950@qq.com> Date: Wed, 5 Jun 2019 12:18:50 +0200 Subject: [PATCH] Remove highlighting and syntect --- Cargo.toml | 1 - default_out.md => default_out.txt | 6 ++---- src/main.rs | 17 ++--------------- 3 files changed, 4 insertions(+), 20 deletions(-) rename default_out.md => default_out.txt (88%) 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.txt similarity index 88% rename from default_out.md rename to default_out.txt index f88969d..55eaa97 100644 --- a/default_out.md +++ b/default_out.txt @@ -1,6 +1,6 @@ -Thanks for installing `rustlings`! +Thanks for installing Rustlings! -## Is this your first time? +Is this your first time? Let's make sure you're up to speed: - You have Rust installed, preferably via `rustup` @@ -9,9 +9,7 @@ Let's make sure you're up to speed: - 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. 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");