Skip to content

Commit ad8d00c

Browse files
lengyijunxFrednet
andauthored
Update clippy_lints/src/pathbuf_init_then_push.rs
Co-authored-by: Fridtjof Stoldt <[email protected]>
1 parent 3f285df commit ad8d00c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

clippy_lints/src/pathbuf_init_then_push.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ declare_clippy_lint! {
1616
/// Checks for calls to `push` immediately after creating a new `PathBuf`.
1717
///
1818
/// ### Why is this bad?
19-
/// The `.join()` is easier to read than multiple `push` calls.
19+
/// Multiple `.join()` calls are usually easier to read than multiple `.push`
20+
/// calls across multiple statements. It might also be possible to use
21+
/// `PathBuf::from` instead.
2022
///
2123
/// ### Known problems
22-
/// `.join()` introduces an implicit `clone()`
24+
/// `.join()` introduces an implicit `clone()`. `PathBuf::from` can alternativly be
25+
/// used when the `PathBuf` is newly constructed. This will avoild the implicit clone.
2326
///
2427
/// ### Example
2528
/// ```rust

0 commit comments

Comments
 (0)