Skip to content

Commit

Permalink
Revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Jun 2, 2024
1 parent 83b4656 commit 93731e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/comments.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use unicode_segmentation::UnicodeSegmentation;

pub fn find_comment_index(line: &str) -> Option<usize> {
// no percent means no comment
if !line.contains("%") {
if !line.contains('%') {
return None;
}

Expand All @@ -14,8 +12,8 @@ pub fn find_comment_index(line: &str) -> Option<usize> {
}

// 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);
}

Expand All @@ -26,8 +24,8 @@ pub fn find_comment_index(line: &str) -> Option<usize> {

// 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;
Expand All @@ -37,7 +35,7 @@ pub fn find_comment_index(line: &str) -> Option<usize> {

pub fn remove_comment(line: &str, comment: Option<usize>) -> &str {
match comment {
Some(c) => &line.graphemes(true)[0..c],
Some(c) => &line[0..c],
None => line,
}
}
Expand Down
1 change: 0 additions & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down

0 comments on commit 93731e3

Please sign in to comment.