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:
Takayuki Nakata 2020-09-08 22:45:27 +09:00 committed by flip1995
parent b80576fba6
commit 14faebe20e
No known key found for this signature in database
GPG key ID: 693086869D506637

View file

@ -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);
}
}