Skip to content

Commit 7503396

Browse files
committed
auto merge of #8441 : erickt/rust/deny-warnings, r=erickt
This patch makes sure that code is warning-free for all of the rust libraries.
2 parents 29a67d1 + cc56708 commit 7503396

File tree

405 files changed

+709
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

405 files changed

+709
-590
lines changed

mk/target.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
6969
| $$(TLIB$(1)_T_$(2)_H_$(3))/
7070
@$$(call E, compile_and_link: $$@)
7171
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
72-
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
72+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
7373
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
7474

7575
# Only build the compiler for host triples
@@ -90,7 +90,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
9090
| $$(TLIB$(1)_T_$(2)_H_$(3))/
9191
@$$(call E, compile_and_link: $$@)
9292
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
93-
$$(STAGE$(1)_T_$(2)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
93+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
9494
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
9595

9696
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \

mk/tools.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
6767
| $$(TLIB$(1)_T_$(4)_H_$(3))/
6868
@$$(call E, compile_and_link: $$@)
6969
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
70-
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
70+
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
7171
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTDOC_GLOB_$(4)),$$(notdir $$@))
7272

7373
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \
@@ -85,7 +85,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
8585
| $$(TLIB$(1)_T_$(4)_H_$(3))/
8686
@$$(call E, compile_and_link: $$@)
8787
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
88-
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
88+
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
8989
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTI_GLOB_$(4)),$$(notdir $$@))
9090

9191
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
@@ -106,7 +106,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
106106
| $$(TLIB$(1)_T_$(4)_H_$(3))/
107107
@$$(call E, compile_and_link: $$@)
108108
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
109-
$$(STAGE$(1)_T_$(4)_H_$(3)) --out-dir $$(@D) $$< && touch $$@
109+
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
110110
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
111111

112112
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \

src/librustc/middle/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl Context {
480480
(orig.visit_item)(it, (self, stopping));
481481
}
482482
NewVisitor(new_visitor) => {
483-
let mut new_visitor = new_visitor;
483+
let new_visitor = new_visitor;
484484
new_visitor.visit_item(it, ());
485485
}
486486
}
@@ -520,7 +520,7 @@ impl Context {
520520
let fk = visit::fk_method(m.ident,
521521
&m.generics,
522522
m);
523-
let mut new_visitor = new_visitor;
523+
let new_visitor = new_visitor;
524524
new_visitor.visit_fn(&fk,
525525
&m.decl,
526526
&m.body,

src/libstd/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ pub mod ptr_tests {
648648
one, two, three
649649
];
650650

651-
do arr.as_imm_buf |arr_ptr, arr_len| {
651+
do arr.as_imm_buf |arr_ptr, _| {
652652
let mut ctr = 0;
653653
let mut iteration_count = 0;
654654
do array_each(arr_ptr) |e| {

src/libsyntax/parse/attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use ast;
1212
use codemap::{spanned, mk_sp};
13-
use codemap::BytePos;
1413
use parse::common::*; //resolve bug?
1514
use parse::token;
1615
use parse::parser::Parser;

src/test/auxiliary/cci_capture_clause.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::comm::*;
1211
use std::task;
1312

1413
pub fn foo<T:Send + Clone>(x: T) -> Port<T> {

src/test/auxiliary/cci_class_5.rs

-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// except according to those terms.
1010

1111
pub mod kitties {
12-
use std::uint;
13-
1412
pub struct cat {
1513
priv meows : uint,
1614
how_hungry : int,
@@ -26,5 +24,4 @@ pub mod kitties {
2624
how_hungry: in_y
2725
}
2826
}
29-
3027
}

src/test/auxiliary/cci_class_cast.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::to_str::*;
12-
1311
pub mod kitty {
1412
pub struct cat {
1513
priv meows : uint,

src/test/auxiliary/crate-method-reexport-grrrrrrr2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub mod name_pool {
2020
}
2121

2222
impl add for name_pool {
23-
fn add(&self, s: ~str) {
23+
fn add(&self, _s: ~str) {
2424
}
2525
}
2626
}

src/test/auxiliary/crateresolve5-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum e {
2525

2626
pub fn nominal() -> e { e_val }
2727

28-
pub fn nominal_eq(e1: e, e2: e) -> bool { true }
28+
pub fn nominal_eq(_e1: e, _e2: e) -> bool { true }
2929

3030
impl Eq for e {
3131
fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) }

src/test/auxiliary/crateresolve5-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ impl Eq for e {
2929

3030
pub fn nominal() -> e { e_val }
3131

32-
pub fn nominal_neq(e1: e, e2: e) -> bool { false }
32+
pub fn nominal_neq(_e1: e, _e2: e) -> bool { false }
3333

3434
pub fn f() -> int { 20 }

src/test/auxiliary/issue-2526.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ fn arc<T:Freeze>(_data: T) -> arc_destruct<T> {
3535
}
3636

3737
fn init() -> arc_destruct<context_res> {
38-
unsafe {
39-
arc(context_res())
40-
}
38+
arc(context_res())
4139
}
4240

4341
struct context_res {

src/test/auxiliary/issue2378a.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
enum maybe<T> { just(T), nothing }
1515

1616
impl <T:Clone> Index<uint,T> for maybe<T> {
17-
fn index(&self, idx: &uint) -> T {
17+
fn index(&self, _idx: &uint) -> T {
1818
match self {
1919
&just(ref t) => (*t).clone(),
2020
&nothing => { fail!(); }

src/test/auxiliary/issue_2316_b.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[allow(unused_imports)];
12+
1113
extern mod issue_2316_a;
1214

1315
pub mod cloth {

src/test/auxiliary/moves_based_on_type_lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ impl Drop for S {
2323
pub fn f() {
2424
let x = S { x: 1 };
2525
let y = x;
26-
let z = y;
26+
let _z = y;
2727
}

src/test/auxiliary/trait_default_method_xc_aux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl A for Something {
1919

2020
trait B<T> {
2121
fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
22-
fn staticthing<U>(z: &Self, x: T, y: U) -> (T, U) { (x, y) }
22+
fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
2323
}
2424

2525
impl<T> B<T> for int { }

src/test/bench/core-std.rs

-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
extern mod extra;
1414

1515
use extra::time::precise_time_s;
16-
use std::int;
1716
use std::io;
1817
use std::os;
1918
use std::rand::RngUtil;
2019
use std::rand;
21-
use std::result;
2220
use std::str;
23-
use std::uint;
2421
use std::util;
2522
use std::vec;
2623

src/test/bench/msgsend-ring-mutex-arcs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use extra::arc;
2121
use extra::future;
2222
use extra::time;
2323
use std::cell::Cell;
24-
use std::io;
2524
use std::os;
2625
use std::uint;
2726

src/test/bench/msgsend-ring-rw-arcs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use extra::arc;
2121
use extra::future;
2222
use extra::time;
2323
use std::cell::Cell;
24-
use std::io;
2524
use std::os;
2625
use std::uint;
2726

src/test/bench/noise.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Perlin noise benchmark from https://gist.github.com/1170424
22

33
use std::float;
4-
use std::int;
54
use std::rand::{Rng, RngUtil};
65
use std::rand;
76

src/test/bench/rt-messaging-ping-pong.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
extern mod extra;
1212

13-
use std::task::spawn;
1413
use std::os;
1514
use std::uint;
1615
use std::rt::test::spawntask_later;

src/test/bench/rt-parfib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
extern mod extra;
1212

13-
use std::task::spawn;
1413
use std::os;
1514
use std::uint;
1615
use std::rt::test::spawntask_later;

src/test/bench/shootout-ackermann.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
extern mod extra;
1212

1313
use std::int;
14-
use std::io;
1514
use std::os;
1615

1716
fn ack(m: int, n: int) -> int {

src/test/bench/shootout-fasta.rs

-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ use std::io;
2222
use std::os;
2323
use std::rand::Rng;
2424
use std::rand;
25-
use std::result;
2625
use std::str;
27-
use std::uint;
2826

2927
static LINE_LENGTH: uint = 60u;
3028

src/test/bench/shootout-fibo.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
extern mod extra;
1212

1313
use std::int;
14-
use std::io;
1514
use std::os;
1615

1716
fn fib(n: int) -> int {

src/test/bench/shootout-k-nucleotide-pipes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use std::io::ReaderUtil;
2222
use std::io;
2323
use std::option;
2424
use std::os;
25-
use std::result;
2625
use std::str;
2726
use std::task;
2827
use std::util;

src/test/bench/sudoku.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ extern mod extra;
1515
use std::io::{ReaderUtil, WriterUtil};
1616
use std::io;
1717
use std::os;
18-
use std::u8;
1918
use std::uint;
2019
use std::unstable::intrinsics::cttz16;
2120
use std::vec;

src/test/codegen/scalar-function-call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ fn foo(x: int) -> int {
1414

1515
#[no_mangle]
1616
fn test() {
17-
let x = foo(10);
17+
let _x = foo(10);
1818
}

src/test/debug-info/basic-types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
// debugger:print f64
5252
// check:$15 = 3.5
5353

54+
#[allow(unused_variable)];
55+
5456
fn main() {
5557
let b: bool = false;
5658
let i: int = -1;

src/test/debug-info/borrowed-basic.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
// debugger:print *f64_ref
6363
// check:$15 = 3.5
6464

65+
#[allow(unused_variable)];
66+
6567
fn main() {
6668
let bool_val: bool = true;
6769
let bool_ref: &bool = &bool_val;
@@ -110,4 +112,4 @@ fn main() {
110112
zzz();
111113
}
112114

113-
fn zzz() {()}
115+
fn zzz() {()}

src/test/debug-info/borrowed-c-style-enum.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
// debugger:print *the_c_ref
2525
// check:$3 = TheC
2626

27+
#[allow(unused_variable)];
28+
2729
enum ABC { TheA, TheB, TheC }
2830

2931
fn main() {
@@ -39,4 +41,4 @@ fn main() {
3941
zzz();
4042
}
4143

42-
fn zzz() {()}
44+
fn zzz() {()}

src/test/debug-info/borrowed-enum.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
// debugger:print *univariant_ref
2525
// check:$3 = {4820353753753434}
2626

27+
#[allow(unused_variable)];
28+
2729
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
2830
// the size of the discriminant value is machine dependent, this has be taken into account when
2931
// datatype layout should be predictable as in this case.
@@ -59,4 +61,4 @@ fn main() {
5961
zzz();
6062
}
6163

62-
fn zzz() {()}
64+
fn zzz() {()}

src/test/debug-info/borrowed-managed-basic.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
// debugger:print *f64_ref
6363
// check:$15 = 3.5
6464

65+
#[allow(unused_variable)];
6566

6667
fn main() {
6768
let bool_box: @bool = @true;
@@ -111,4 +112,4 @@ fn main() {
111112
zzz();
112113
}
113114

114-
fn zzz() {()}
115+
fn zzz() {()}

src/test/debug-info/borrowed-struct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
// debugger:print *unique_val_interior_ref_2
4646
// check:$10 = 26.5
4747

48-
48+
#[allow(unused_variable)];
4949

5050
struct SomeStruct {
5151
x: int,
@@ -72,4 +72,4 @@ fn main() {
7272
zzz();
7373
}
7474

75-
fn zzz() {()}
75+
fn zzz() {()}

src/test/debug-info/borrowed-tuple.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
// debugger:print *unique_val_ref
2828
// check:$4 = {-17, -22}
2929

30+
#[allow(unused_variable)];
31+
3032
fn main() {
3133
let stack_val: (i16, f32) = (-14, -19f32);
3234
let stack_val_ref: &(i16, f32) = &stack_val;
@@ -41,4 +43,4 @@ fn main() {
4143
zzz();
4244
}
4345

44-
fn zzz() {()}
46+
fn zzz() {()}

0 commit comments

Comments
 (0)