summaryrefslogtreecommitdiffstats
path: root/tests/ui/unused-crate-deps/libfib.rs
blob: c1545dca99f57b3a0fa9f891c3281dc16eaa1577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test warnings for a library crate

// check-pass
// aux-crate:bar=bar.rs
// compile-flags:--crate-type lib -Wunused-crate-dependencies

pub fn fib(n: u32) -> Vec<u32> {
//~^ WARNING external crate `bar` unused in
let mut prev = 0;
    let mut cur = 1;
    let mut v = vec![];

    for _ in 0..n {
        v.push(prev);
        let n = prev + cur;
        prev = cur;
        cur = n;
    }

    v
}