1
0
mirror of https://github.com/jht5945/finding.git synced 2025-12-28 13:40:04 +08:00

use chars

This commit is contained in:
2020-05-02 00:18:56 +08:00
parent e0a85b1368
commit 5b78fa85bc

View File

@@ -92,7 +92,7 @@ fn match_lines(tag: &str, content: &str, options: &Options) -> bool {
for (line_no, ln) in lines.enumerate() { for (line_no, ln) in lines.enumerate() {
if options.filter_large_line && ln.len() as u64 >= options.parsed_large_line_size { if options.filter_large_line && ln.len() as u64 >= options.parsed_large_line_size {
if options.verbose { if options.verbose {
clear_n_print_message(MessageType::DEBUG, &format!("Skip large line: {} bytes", ln.len())); clear_n_print_message(MessageType::DEBUG, &format!("Skip large line: {} chars", ln.len()));
} }
continue; continue;
} }
@@ -106,9 +106,7 @@ fn match_lines(tag: &str, content: &str, options: &Options) -> bool {
} }
} }
if match_lines_vec.is_empty() { if !match_lines_vec.is_empty() {
false
} else {
clear_n_print_message(MessageType::OK, &format!("Find in {}:", tag)); clear_n_print_message(MessageType::OK, &format!("Find in {}:", tag));
for match_line in &match_lines_vec { for match_line in &match_lines_vec {
print!("{}: ", match_line.line_number + 1); print!("{}: ", match_line.line_number + 1);
@@ -125,8 +123,8 @@ fn match_lines(tag: &str, content: &str, options: &Options) -> bool {
println!(); println!();
} }
} }
true
} }
!match_lines_vec.is_empty()
} }
fn find_text_files(options: &Options, dir_path: &Path) { fn find_text_files(options: &Options, dir_path: &Path) {