fixed bug that had to deal with mut and non mut suggestion
This commit is contained in:
parent
2dbf0c138d
commit
8a4ffb881d
4 changed files with 25 additions and 5 deletions
|
|
@ -41,7 +41,12 @@ fn main() {
|
|||
|
||||
let mut heap = BinaryHeap::from(vec![1, 3]);
|
||||
let mut heap2 = BinaryHeap::from(vec![]);
|
||||
heap2.extend(heap.drain())
|
||||
heap2.extend(heap.drain());
|
||||
|
||||
let mut x = vec![0, 1, 2, 3, 5];
|
||||
let ref_x = &mut x;
|
||||
let mut y = Vec::new();
|
||||
y.append(ref_x);
|
||||
}
|
||||
|
||||
fn return_vector() -> Vec<u8> {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,12 @@ fn main() {
|
|||
|
||||
let mut heap = BinaryHeap::from(vec![1, 3]);
|
||||
let mut heap2 = BinaryHeap::from(vec![]);
|
||||
heap2.extend(heap.drain())
|
||||
heap2.extend(heap.drain());
|
||||
|
||||
let mut x = vec![0, 1, 2, 3, 5];
|
||||
let ref_x = &mut x;
|
||||
let mut y = Vec::new();
|
||||
y.extend(ref_x.drain(..));
|
||||
}
|
||||
|
||||
fn return_vector() -> Vec<u8> {
|
||||
|
|
|
|||
|
|
@ -18,5 +18,11 @@ error: use of `extend` instead of `append` for adding the full range of a second
|
|||
LL | vec11.extend(return_vector().drain(..));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec11.append(&mut return_vector())`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: use of `extend` instead of `append` for adding the full range of a second vector
|
||||
--> $DIR/extend_with_drain.rs:49:5
|
||||
|
|
||||
LL | y.extend(ref_x.drain(..));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `y.append(ref_x)`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue