Skip to content

Commit

Permalink
Remove redundant clone() call.
Browse files Browse the repository at this point in the history
Calling clone() on a &str (str reference) will result in a noop instruction, as str doesn't implement Clone, so we'd only be copying the reference which does nothing.
  • Loading branch information
glomdom committed Sep 24, 2023
1 parent 558e3dc commit 77e363b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bin/parser_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn read_tests(file_path: PathBuf) -> io::Result<Vec<Test>> {

let mut tests = Vec::new();
let mut current_test = Test {
file_path: file_path.to_str().unwrap().clone().to_string(),
file_path: file_path.to_str().unwrap().to_string(),
line: 1,
data: "".to_string(),
errors: vec![],
Expand All @@ -95,7 +95,7 @@ fn read_tests(file_path: PathBuf) -> io::Result<Vec<Test>> {
current_test.data = current_test.data.trim_end().to_string();
tests.push(current_test);
current_test = Test {
file_path: file_path.to_str().unwrap().clone().to_string(),
file_path: file_path.to_str().unwrap().to_string(),
line: line_num,
data: "".to_string(),
errors: vec![],
Expand Down

0 comments on commit 77e363b

Please sign in to comment.