mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-24 08:56:43 +02:00
assert that working-set element 0 is None
This commit is contained in:
parent
5f6918fbc7
commit
73b6648d06
1 changed files with 4 additions and 0 deletions
|
@ -21,6 +21,10 @@ impl WorkingSet {
|
|||
/// Create a new WorkingSet. Typically this is acquired via `replica.working_set()`
|
||||
pub(crate) fn new(by_index: Vec<Option<Uuid>>) -> Self {
|
||||
let mut by_uuid = HashMap::new();
|
||||
|
||||
// working sets are 1-indexed, so element 0 should always be None
|
||||
assert!(by_index.is_empty() || by_index[0].is_none());
|
||||
|
||||
for (index, uuid) in by_index.iter().enumerate() {
|
||||
if let Some(uuid) = uuid {
|
||||
by_uuid.insert(*uuid, index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue