Skip to content

Commit 040c3b0

Browse files
committed
link search to run
1 parent e07ce85 commit 040c3b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ impl Config {
1818

1919
pub fn run(config: Config) -> Result<(), Box<dyn Error>> {
2020
let contents = fs::read_to_string(config.file_path)?;
21-
println!("With text contents:\n{}", contents);
21+
for line in search(&config.query, &contents) {
22+
println!("{}", line);
23+
}
2224
Ok(())
2325
}
2426

2527
pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> {
2628
let mut results: Vec<&str> = Vec::new();
2729

2830
for line in contents.lines() {
29-
println!("Current line: {}", line);
3031
if line.contains(query) {
3132
results.push(line);
3233
}

0 commit comments

Comments
 (0)