Skip to content

Add ApplyOrder::Recursive to replace None: Option<ApplyOrder> and remove nested pattern matching. #4917

@HaoYang670

Description

@HaoYang670

Currently, we use None to represent an optimizing rule to be recursively applied to its children.
And we use Some(TopDown) and Some(BottomUp) to represent a rule can be directly applied to the child node.

The None usage can be directly replaced by introducing a new product type ApplyOrder::Recursive.
This can

  • remove the usage of nested pattern matching,
  • better comment the code ,
  • and help the rust compiler to better optimize the code.

This is a follow-up of #4618.

Describe the solution you'd like

pub enum ApplyOrder {
     /// ...
    TopDown,
    /// ...
    BottomUp,
    /// ...
    Recursive,
}

Describe alternatives you've considered
We could not do this.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions