2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2013-02-25 11:12:22 -06:00
|
|
|
#[deny(unused_imports)];
|
2013-02-05 01:01:02 -06:00
|
|
|
|
2012-09-05 14:32:05 -05:00
|
|
|
use cal = bar::c::cc;
|
2011-11-10 09:31:55 -06:00
|
|
|
|
2013-05-24 21:35:29 -05:00
|
|
|
use std::io;
|
|
|
|
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::either::Right; //~ ERROR unused import
|
2013-02-05 01:01:02 -06:00
|
|
|
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::util::*; // shouldn't get errors for not using
|
2013-02-05 01:01:02 -06:00
|
|
|
// everything imported
|
|
|
|
|
2013-03-26 15:08:59 -05:00
|
|
|
// Should get errors for both 'Some' and 'None'
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::option::{Some, None}; //~ ERROR unused import
|
2013-03-26 15:38:07 -05:00
|
|
|
//~^ ERROR unused import
|
2013-02-05 01:01:02 -06:00
|
|
|
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::io::ReaderUtil; //~ ERROR unused import
|
2013-02-05 11:29:45 -06:00
|
|
|
// Be sure that if we just bring some methods into scope that they're also
|
|
|
|
// counted as being used.
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::io::WriterUtil;
|
2013-02-05 11:29:45 -06:00
|
|
|
|
2013-03-26 15:08:59 -05:00
|
|
|
// Make sure this import is warned about when at least one of its imported names
|
|
|
|
// is unused
|
2013-06-29 00:05:50 -05:00
|
|
|
use std::vec::{filter, from_elem}; //~ ERROR unused import
|
2013-03-26 15:08:59 -05:00
|
|
|
|
2011-11-10 09:31:55 -06:00
|
|
|
mod foo {
|
2013-02-05 01:01:02 -06:00
|
|
|
pub struct Point{x: int, y: int}
|
|
|
|
pub struct Square{p: Point, h: uint, w: uint}
|
2011-11-10 09:31:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod bar {
|
2013-02-25 10:37:17 -06:00
|
|
|
// Don't ignore on 'pub use' because we're not sure if it's used or not
|
2013-05-20 19:07:24 -05:00
|
|
|
pub use std::cmp::Eq;
|
2013-02-25 10:37:17 -06:00
|
|
|
|
2013-01-30 16:30:22 -06:00
|
|
|
pub mod c {
|
2013-02-05 01:01:02 -06:00
|
|
|
use foo::Point;
|
|
|
|
use foo::Square; //~ ERROR unused import
|
|
|
|
pub fn cc(p: Point) -> int { return 2 * (p.x + p.y); }
|
2011-11-10 09:31:55 -06:00
|
|
|
}
|
2013-02-25 11:12:22 -06:00
|
|
|
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
mod foo {
|
2013-05-20 19:07:24 -05:00
|
|
|
use std::cmp::Eq;
|
2013-02-25 11:12:22 -06:00
|
|
|
}
|
2011-11-10 09:31:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2013-02-05 01:01:02 -06:00
|
|
|
cal(foo::Point{x:3, y:9});
|
|
|
|
let a = 3;
|
|
|
|
ignore(a);
|
2013-05-19 00:07:44 -05:00
|
|
|
io::stdout().write_str("a");
|
2013-06-29 00:05:50 -05:00
|
|
|
let _a = from_elem(0, 0);
|
2011-11-10 09:31:55 -06:00
|
|
|
}
|