From 5a6ca6bd839cc8cbe40854fc5245ee1756a347f6 Mon Sep 17 00:00:00 2001 From: pwygab Date: Fri, 20 Jan 2023 21:34:54 +0800 Subject: [PATCH] docs for valid use --- clippy_lints/src/paths_from_format.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clippy_lints/src/paths_from_format.rs b/clippy_lints/src/paths_from_format.rs index a006ad46410e..6d742ffc6e1f 100644 --- a/clippy_lints/src/paths_from_format.rs +++ b/clippy_lints/src/paths_from_format.rs @@ -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('\\'))