Skip to content

Commit

Permalink
docs: fix a code snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub authored Aug 6, 2023
1 parent 5a46354 commit baadbcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CODE_STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fn push_path(list: &mut Vec<PathBuf>, item: &Path) {
list.push(item.to_path_buf());
}

push_path(my_list, my_path_buf);
push_path(my_list, my_path_ref.to_path_buf());
push_path(my_list, &my_path_buf);
push_path(my_list, my_path_ref);
```

The above code is suboptimal because it forces the [copying] of `my_path_buf` even though the type of `my_path_buf` is already `PathBuf`.
Expand Down

0 comments on commit baadbcc

Please sign in to comment.