We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d436d9c commit 9d835c3Copy full SHA for 9d835c3
src/uu/cp/src/copydir.rs
@@ -204,10 +204,8 @@ impl Entry {
204
translate!("cp-error-failed-to-create-directory", "error" => e)
205
);
206
}
207
- } else if let Ok(stripped) =
208
- // The following unwrap is unreachable because context.root is always *something*.
209
- descendant
210
- .strip_prefix(context.root.components().next_back().unwrap())
+ } else if let Some(prefix) = context.root.components().next_back()
+ && let Ok(stripped) = descendant.strip_prefix(prefix)
211
{
212
descendant = stripped.to_path_buf();
213
0 commit comments