fix(downloads): allow the deliberate join_absolute_paths lint in a test
The assertion documents that PathBuf::join discards its base when handed an absolute path — which is why confinement has to happen after the join, not instead of it. clippy::join_absolute_paths flags that shape, correctly for production code, so the lint is allowed here rather than the test weakened. Worth recording: this lint would not have caught the original defect. The real join sites pass a variable, and it only fires on a literal.
This commit is contained in:
@@ -2568,11 +2568,20 @@ mod tests {
|
||||
|
||||
// Why the absolute case needs its own guard rather than folding: the
|
||||
// join the download path performs discards the base entirely.
|
||||
//
|
||||
// clippy::join_absolute_paths flags exactly this shape, and is right to
|
||||
// in production code — here the discarded base *is* the assertion, so
|
||||
// the lint is allowed rather than the code changed. Note the lint would
|
||||
// not have caught the original defect: the real join sites take a
|
||||
// variable, and the lint only fires on a literal starting with `/`.
|
||||
#[allow(clippy::join_absolute_paths)]
|
||||
{
|
||||
assert_eq!(
|
||||
PathBuf::from(root).join("/etc/cron.d/pwn"),
|
||||
PathBuf::from("/etc/cron.d/pwn")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The paths the app builds for itself have to survive unchanged: files are
|
||||
/// already on disk and `downloads` rows point at these exact spellings.
|
||||
|
||||
Reference in New Issue
Block a user