Add some tests to same_item_push
Add tests in which the variable is initialized with a match expression and function call
This commit is contained in:
parent
b80576fba6
commit
14faebe20e
@ -11,6 +11,10 @@ fn increment(x: u8) -> u8 {
|
||||
x + 1
|
||||
}
|
||||
|
||||
fn fun() -> usize {
|
||||
42
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Test for basic case
|
||||
let mut spaces = Vec::with_capacity(10);
|
||||
@ -124,4 +128,21 @@ fn main() {
|
||||
for _ in 0..20 {
|
||||
vec17.push(item);
|
||||
}
|
||||
|
||||
let mut vec18 = Vec::new();
|
||||
let item = 42;
|
||||
let item = fun();
|
||||
for _ in 0..20 {
|
||||
vec18.push(item);
|
||||
}
|
||||
|
||||
let mut vec19 = Vec::new();
|
||||
let key = 1;
|
||||
for _ in 0..20 {
|
||||
let item = match key {
|
||||
1 => 10,
|
||||
_ => 0,
|
||||
};
|
||||
vec19.push(item);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user