// TDD: Bug #6 - Enum destructuring creates borrowed variables
// When extracting values from enum variants, they need deref in comparisons
enum Condition {
ThresholdCheck(i32),
}
fn get_value() -> i32 {
return 42;
}
fn check_condition(cond: Condition) -> bool {
match cond {
Condition::ThresholdCheck(threshold) => {
// Bug #6: threshold extracted from enum is &i32, not i32
// Should auto-deref: get_value() > *threshold
// Currently: error[E0308]: expected i32, found &i32
return get_value() > threshold;
}
}
}
fn main() {
let cond = Condition::ThresholdCheck(30);
let result = check_condition(cond);
println!("Result: {}", result);
}