Closed j-mendez closed 1 year ago
@cfvescovo @cfvescovo .or
is evaluated regardless if it is true. For this situation we do not need to create a new hashset eagerly and can move it lazily.
We can use or for this block in the element_ref
and it makes sense since we want this to be fast during this execution.
fn is_root(&self) -> bool {
self.parent()
.map_or_else(|| false, |parent| parent.value().is_document())
}
I know but Rust's collections generally don't allocate on initialisation, so an eager String::new() or HashMap::new() doesn't really matter
However I see your point so I removed my comment
I know but Rust's collections generally don't allocate on initialisation, so an eager String::new() or HashMap::new() doesn't really matter
We want to leave the stack alone for this and should be fine to move it lazy. I can revert the change to keep it just with the build deps.
I was referencing this: https://stackoverflow.com/a/73785382
I know but Rust's collections generally don't allocate on initialisation, so an eager String::new() or HashMap::new() doesn't really matter
We want to leave the stack alone for this and should be fine to move it lazy. I can revert the change to keep it just with the build deps.
Keep your changes, I see your point. It won't make much of a difference but ok.
@cfvescovo thank you for the fast replies - fixing the format issues now.
Cargo fmt is complaining, rerun the formatter
@j-mendez thank you!