diff --git a/src/comments.rs b/src/comments.rs index e6c9106..d6f330e 100644 --- a/src/comments.rs +++ b/src/comments.rs @@ -1,8 +1,6 @@ -use unicode_segmentation::UnicodeSegmentation; - pub fn find_comment_index(line: &str) -> Option { // no percent means no comment - if !line.contains("%") { + if !line.contains('%') { return None; } @@ -14,8 +12,8 @@ pub fn find_comment_index(line: &str) -> Option { } // check the first character - let mut prev_c: &str = line.graphemes(true).next().unwrap(); - if prev_c == "%" { + let mut prev_c: char = line.chars().next().unwrap(); + if prev_c == '%' { return Some(0); } @@ -26,8 +24,8 @@ pub fn find_comment_index(line: &str) -> Option { // multi-character line for i in 1..n { - let c = line.graphemes(true).nth(i).unwrap(); - if c == "%" && (prev_c == " " || prev_c != "\\") { + let c = line.chars().nth(i).unwrap(); + if c == '%' && (prev_c == ' ' || prev_c != '\\') { return Some(i); } prev_c = c; @@ -37,7 +35,7 @@ pub fn find_comment_index(line: &str) -> Option { pub fn remove_comment(line: &str, comment: Option) -> &str { match comment { - Some(c) => &line.graphemes(true)[0..c], + Some(c) => &line[0..c], None => line, } } diff --git a/src/tests.rs b/src/tests.rs index 120f295..b8a2771 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -27,7 +27,6 @@ use crate::Cli; #[case::tikz_network("tikz_network", "sty")] #[case::verbatim("verbatim", "tex")] #[case::verbatim("wgu_cv", "cls")] -#[case::unicode("unicode", "tex")] #[case::wrap("wrap", "tex")] fn test_file(#[case] filename: &str, #[case] extension: &str) {}