fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: usage of `contains_key` followed by `insert` on a `HashMap` 2 --> $DIR/entry_with_else.rs:14:5 3 | 4LL | / if !m.contains_key(&k) { 5LL | | m.insert(k, v); 6LL | | } else { 7LL | | m.insert(k, v2); 8LL | | } 9 | |_____^ 10 | 11 = note: `-D clippy::map-entry` implied by `-D warnings` 12 = help: to override `-D warnings` add `#[allow(clippy::map_entry)]` 13help: try 14 | 15LL ~ match m.entry(k) { 16LL + std::collections::hash_map::Entry::Vacant(e) => { 17LL + e.insert(v); 18LL + } 19LL + std::collections::hash_map::Entry::Occupied(mut e) => { 20LL + e.insert(v2); 21LL + } 22LL + } 23 | 24 25error: usage of `contains_key` followed by `insert` on a `HashMap` 26 --> $DIR/entry_with_else.rs:20:5 27 | 28LL | / if m.contains_key(&k) { 29LL | | m.insert(k, v); 30LL | | } else { 31LL | | m.insert(k, v2); 32LL | | } 33 | |_____^ 34 | 35help: try 36 | 37LL ~ match m.entry(k) { 38LL + std::collections::hash_map::Entry::Occupied(mut e) => { 39LL + e.insert(v); 40LL + } 41LL + std::collections::hash_map::Entry::Vacant(e) => { 42LL + e.insert(v2); 43LL + } 44LL + } 45 | 46 47error: usage of `contains_key` followed by `insert` on a `HashMap` 48 --> $DIR/entry_with_else.rs:26:5 49 | 50LL | / if !m.contains_key(&k) { 51LL | | m.insert(k, v); 52LL | | } else { 53LL | | foo(); 54LL | | } 55 | |_____^ 56 | 57help: try 58 | 59LL ~ if let std::collections::hash_map::Entry::Vacant(e) = m.entry(k) { 60LL + e.insert(v); 61LL + } else { 62LL + foo(); 63LL + } 64 | 65 66error: usage of `contains_key` followed by `insert` on a `HashMap` 67 --> $DIR/entry_with_else.rs:32:5 68 | 69LL | / if !m.contains_key(&k) { 70LL | | foo(); 71LL | | } else { 72LL | | m.insert(k, v); 73LL | | } 74 | |_____^ 75 | 76help: try 77 | 78LL ~ if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) { 79LL + e.insert(v); 80LL + } else { 81LL + foo(); 82LL + } 83 | 84 85error: usage of `contains_key` followed by `insert` on a `HashMap` 86 --> $DIR/entry_with_else.rs:38:5 87 | 88LL | / if !m.contains_key(&k) { 89LL | | m.insert(k, v); 90LL | | } else { 91LL | | m.insert(k, v2); 92LL | | } 93 | |_____^ 94 | 95help: try 96 | 97LL ~ match m.entry(k) { 98LL + std::collections::hash_map::Entry::Vacant(e) => { 99LL + e.insert(v); 100LL + } 101LL + std::collections::hash_map::Entry::Occupied(mut e) => { 102LL + e.insert(v2); 103LL + } 104LL + } 105 | 106 107error: usage of `contains_key` followed by `insert` on a `HashMap` 108 --> $DIR/entry_with_else.rs:44:5 109 | 110LL | / if m.contains_key(&k) { 111LL | | if true { m.insert(k, v) } else { m.insert(k, v2) } 112LL | | } else { 113LL | | m.insert(k, v) 114LL | | }; 115 | |_____^ 116 | 117help: try 118 | 119LL ~ match m.entry(k) { 120LL + std::collections::hash_map::Entry::Occupied(mut e) => { 121LL + if true { Some(e.insert(v)) } else { Some(e.insert(v2)) } 122LL + } 123LL + std::collections::hash_map::Entry::Vacant(e) => { 124LL + e.insert(v); 125LL + None 126LL + } 127LL ~ }; 128 | 129 130error: usage of `contains_key` followed by `insert` on a `HashMap` 131 --> $DIR/entry_with_else.rs:50:5 132 | 133LL | / if m.contains_key(&k) { 134LL | | foo(); 135LL | | m.insert(k, v) 136LL | | } else { 137LL | | None 138LL | | }; 139 | |_____^ 140 | 141help: try 142 | 143LL ~ if let std::collections::hash_map::Entry::Occupied(mut e) = m.entry(k) { 144LL + foo(); 145LL + Some(e.insert(v)) 146LL + } else { 147LL + None 148LL ~ }; 149 | 150 151error: aborting due to 7 previous errors 152