Skip to content

Commit c652829

Browse files
committed
don't depend on [!Default; 0]: Default impl
NB: in `&[]` the array is "const promoted", making this reference have type `&'static [T; 0]`. this allows us to return that reference from any function returning a reference to a slice or array, because `&'static _` can coerce to `&'short_lifetime _`. it's not necessary to have a field for this.
1 parent c3a1b34 commit c652829

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

solver/src/reasoners/cp/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use std::collections::{HashMap, HashSet};
3434
#[derive(Clone, Default)]
3535
pub struct Watches {
3636
propagations: RefMap<SignedVar, Vec<PropagatorId>>,
37-
empty: [PropagatorId; 0],
3837
}
3938

4039
impl Watches {
@@ -71,7 +70,7 @@ impl Watches {
7170
/// Returns all propagators
7271
fn get_ub_watches(&self, var: impl Into<SignedVar>) -> &[PropagatorId] {
7372
let var = var.into();
74-
self.propagations.get(var).map(|v| v.as_slice()).unwrap_or(&self.empty)
73+
self.propagations.get(var).map(|v| v.as_slice()).unwrap_or(&[])
7574
}
7675
}
7776

0 commit comments

Comments
 (0)