summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/mut-ref-reassignment.rs
blob: 1428324934de210343659b1417e205efd5866b96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn suggestion(opt: &mut Option<String>) {
    opt = None; //~ ERROR mismatched types
}

fn no_suggestion(opt: &mut Result<String, ()>) {
    opt = None //~ ERROR mismatched types
}

fn suggestion2(opt: &mut Option<String>) {
    opt = Some(String::new())//~ ERROR mismatched types
}

fn no_suggestion2(opt: &mut Option<String>) {
    opt = Some(42)//~ ERROR mismatched types
}

fn main() {}