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 9b1f458 commit 9a8c8a5Copy full SHA for 9a8c8a5
src/uu/cp/src/copydir.rs
@@ -204,10 +204,11 @@ 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(stripped) = context
+ .root
+ .components()
+ .next_back()
211
+ .and_then(|stripped| descendant.strip_prefix(stripped).ok())
212
{
213
descendant = stripped.to_path_buf();
214
0 commit comments