Skip to content

Commit

Permalink
docs for valid use
Browse files Browse the repository at this point in the history
  • Loading branch information
merelymyself committed Jan 20, 2023
1 parent 6c2f56f commit 5a6ca6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clippy_lints/src/paths_from_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ fn push_comps(string: &mut String, path: &str) {
}
}

// In essence, this checks if the format!() used is made for concatenation of the filenames / folder names itself.
// This returns true when it is something like `PathBuf::from(format!("/x/folder{}/textfile.txt", folder_number))
fn is_valid_use_case(string: &str, string2: &str) -> bool {
!(string.is_empty() || string.ends_with('/') || string.ends_with('\\'))
|| !(string2.is_empty() || string2.starts_with('/') || string2.starts_with('\\'))
Expand Down

0 comments on commit 5a6ca6b

Please sign in to comment.