Skip to content

Commit 77c2a6e

Browse files
committed
rebless the ui tests
1 parent 23dfcb0 commit 77c2a6e

4 files changed

Lines changed: 29 additions & 13 deletions

File tree

tests/ui/borrowck/index-mut-help.stderr

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | map["peter"].clear();
88
help: to modify a `HashMap<&str, String>` use `.get_mut()`
99
|
1010
LL - map["peter"].clear();
11-
LL + if let Some(val) = map.get_mut("peter") { val.clear(); };
11+
LL + if let Some(val) = map.get_mut(&"peter") { val.clear(); };
1212
|
1313

1414
error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
@@ -18,16 +18,20 @@ LL | map["peter"] = "0".to_string();
1818
| ^^^^^^^^^^^^ cannot assign
1919
|
2020
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
21-
help: use `.insert()` to insert a value into a `HashMap<&str, String>`, `.get_mut()` to modify it, or the entry API for more flexibility
21+
help: use `.insert()` to insert a value into a `HashMap<&str, String>`
2222
|
2323
LL - map["peter"] = "0".to_string();
2424
LL + map.insert("peter", "0".to_string());
2525
|
26+
help: use `.get_mut()` to modify an existing key in a `HashMap<&str, String>`
27+
|
2628
LL - map["peter"] = "0".to_string();
27-
LL + if let Some(val) = map.get_mut("peter") { *val = "0".to_string(); };
29+
LL + if let Some(val) = map.get_mut(&"peter") { *val = "0".to_string(); };
30+
|
31+
help: use the entry API to modify a `HashMap<&str, String>` for more flexibility
2832
|
2933
LL - map["peter"] = "0".to_string();
30-
LL + let val = map.entry("peter").or_insert("0".to_string());
34+
LL + let val = map.entry("peter").insert_entry("0".to_string());
3135
|
3236

3337
error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable

tests/ui/btreemap/btreemap-index-mut-2.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ LL | map[&0] = 1;
55
| ^^^^^^^^^^^ cannot assign
66
|
77
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>`
8-
help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility
8+
help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`
99
|
1010
LL - map[&0] = 1;
11-
LL + map.insert(&0, 1);
11+
LL + map.insert(*&0, 1);
12+
|
13+
help: use `.get_mut()` to modify an existing key in a `BTreeMap<u32, u32>`
1214
|
1315
LL - map[&0] = 1;
1416
LL + if let Some(val) = map.get_mut(&0) { *val = 1; };
1517
|
18+
help: use the entry API to modify a `BTreeMap<u32, u32>` for more flexibility
19+
|
1620
LL - map[&0] = 1;
17-
LL + let val = map.entry(&0).or_insert(1);
21+
LL + let val = map.entry(*&0).insert_entry(1);
1822
|
1923

2024
error: aborting due to 1 previous error

tests/ui/btreemap/btreemap-index-mut.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ LL | map[&0] = 1;
55
| ^^^^^^^^^^^ cannot assign
66
|
77
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>`
8-
help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility
8+
help: use `.insert()` to insert a value into a `BTreeMap<u32, u32>`
99
|
1010
LL - map[&0] = 1;
11-
LL + map.insert(&0, 1);
11+
LL + map.insert(*&0, 1);
12+
|
13+
help: use `.get_mut()` to modify an existing key in a `BTreeMap<u32, u32>`
1214
|
1315
LL - map[&0] = 1;
1416
LL + if let Some(val) = map.get_mut(&0) { *val = 1; };
1517
|
18+
help: use the entry API to modify a `BTreeMap<u32, u32>` for more flexibility
19+
|
1620
LL - map[&0] = 1;
17-
LL + let val = map.entry(&0).or_insert(1);
21+
LL + let val = map.entry(*&0).insert_entry(1);
1822
|
1923

2024
error: aborting due to 1 previous error

tests/ui/hashmap/hashmap-index-mut.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ LL | map[&0] = 1;
55
| ^^^^^^^^^^^ cannot assign
66
|
77
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<u32, u32>`
8-
help: use `.insert()` to insert a value into a `HashMap<u32, u32>`, `.get_mut()` to modify it, or the entry API for more flexibility
8+
help: use `.insert()` to insert a value into a `HashMap<u32, u32>`
99
|
1010
LL - map[&0] = 1;
11-
LL + map.insert(&0, 1);
11+
LL + map.insert(*&0, 1);
12+
|
13+
help: use `.get_mut()` to modify an existing key in a `HashMap<u32, u32>`
1214
|
1315
LL - map[&0] = 1;
1416
LL + if let Some(val) = map.get_mut(&0) { *val = 1; };
1517
|
18+
help: use the entry API to modify a `HashMap<u32, u32>` for more flexibility
19+
|
1620
LL - map[&0] = 1;
17-
LL + let val = map.entry(&0).or_insert(1);
21+
LL + let val = map.entry(*&0).insert_entry(1);
1822
|
1923

2024
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)