style: Refactor the traversal so it's more easy to read and straight-forward.

This commit is contained in:
Emilio Cobos Álvarez 2017-02-01 14:28:47 +01:00
parent 8859aa004f
commit 2594cb9c33
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
5 changed files with 162 additions and 113 deletions

View file

@ -184,13 +184,11 @@ impl RuleTree {
/// Replaces a rule in a given level (if present) for another rule.
///
/// Returns the resulting node that represents the new path.
///
/// TODO(emilio): Maybe this should be in `StrongRuleNode`?
pub fn replace_rule_at_level_if_applicable(&self,
level: CascadeLevel,
pdb: Option<&Arc<RwLock<PropertyDeclarationBlock>>>,
path: StrongRuleNode)
-> StrongRuleNode {
pub fn update_rule_at_level(&self,
level: CascadeLevel,
pdb: Option<&Arc<RwLock<PropertyDeclarationBlock>>>,
path: StrongRuleNode)
-> StrongRuleNode {
debug_assert!(level.is_unique_per_element());
// TODO(emilio): Being smarter with lifetimes we could avoid a bit of
// the refcount churn.