Skip to content

Commit

Permalink
Add min_ergonomics ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 18, 2024
1 parent 4cd75c1 commit 0a7b861
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/rulesets/ty_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl RuleOptions {
]
} else if matches!(
self.inherited_ref_on_ref,
InheritedRefOnRefBehavior::EatOuter
InheritedRefOnRefBehavior::EatOuter | InheritedRefOnRefBehavior::Error
) {
&["fallback_to_outer", "eat_mut_inside_shared"]
} else {
Expand Down Expand Up @@ -369,13 +369,19 @@ impl RuleOptions {
match_constructor_through_ref: false,
ref_binding_on_inherited: RefBindingOnInheritedBehavior::Error,
mut_binding_on_inherited: MutBindingOnInheritedBehavior::Error,
fallback_to_outer: false,
inherited_ref_on_ref: InheritedRefOnRefBehavior::Error,
allow_ref_pat_on_ref_mut: false,
eat_inherited_ref_alone: false,
eat_mut_inside_shared: false,
..Self::STATELESS
};

/// The minimal amout of match ergonomics that's forward-compatible with most proposals.
pub const MIN_ERGONOMICS: Self = RuleOptions {
match_constructor_through_ref: true,
..Self::STRUCTURAL
};

pub const RFC3627_2021: Self = RuleOptions {
mut_binding_on_inherited: MutBindingOnInheritedBehavior::ResetBindingMode,
inherited_ref_on_ref: InheritedRefOnRefBehavior::EatBoth,
Expand Down Expand Up @@ -447,6 +453,11 @@ pub static KNOWN_TY_BASED_BUNDLES: &[BundleDoc<RuleOptions>] = &[
ruleset: RuleOptions::ERGO2024_BREAKING_ONLY,
doc: "The breaking changes for edition 2024 planned in RFC3627",
},
BundleDoc {
name: "min_ergonomics",
ruleset: RuleOptions::MIN_ERGONOMICS,
doc: "The minimal amout of match ergonomics that's forward-compatible with most proposals",
},
BundleDoc {
name: "structural",
ruleset: RuleOptions::STRUCTURAL,
Expand Down

0 comments on commit 0a7b861

Please sign in to comment.