rm: don't update target_exists every time in the loop (#6837)

This commit is contained in:
nibon7 2022-10-21 22:42:29 +08:00 committed by GitHub
parent b2c29117d9
commit c6436eb32f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,10 +231,12 @@ fn rm(
) {
Ok(files) => {
for file in files {
target_exists = true;
match file {
Ok(ref f) => {
if !target_exists {
target_exists = true;
}
// It is not appropriate to try and remove the
// current directory or its parent when using
// glob patterns.