1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
17 fn suggest_remove_deref() {
18 let a = &A("".to_string());
24 let a = [A("".to_string())];
29 fn suggest_borrow2() {
30 let mut a = A("".to_string());
36 fn suggest_borrow3() {
38 let mut a = A("".to_string());
44 fn suggest_borrow4() {
45 let a = [A("".to_string())][0];
49 fn suggest_borrow5() {
50 let a = &A("".to_string());
56 let c = C(D(String::new()));
61 fn suggest_nothing() {
62 let a = &A("".to_string());
79 struct F(String, String);
85 fn probably_suggest_borrow() {
86 let x = [B::V(String::new())];
94 fn have_to_suggest_ref() {
95 let x = B::V(String::new());
103 fn two_separate_errors() {
104 let x = (D(String::new()), &String::new());
113 fn have_to_suggest_double_ref() {
114 let x = F(String::new(), String::new());
122 fn double_binding(x: &Result<String, String>) {
125 Ok(s) | Err(s) => (),