-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`
Description
Currently, Dlist::split_off requires its argument to be strictly less than the length of the list, which means the following function panics when passed a one-element list. Instead, it should leave the original list unmodified and return an empty list:
fn split_head<T>(list: &mut DList<T>) -> DList<T> {
list.split_off(1)
}In contrast, Vec::split_off does allow self.len() as a valid argument, so the above code works as desired if you replace DList with Vec.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`