Skip to content

Commit 1f62b23

Browse files
committed
auto merge of #6431 : catamorphism/rust/warnings, r=catamorphism
Just cleaning up warnings.
2 parents 35e6ce5 + a279d65 commit 1f62b23

File tree

29 files changed

+58
-144
lines changed

29 files changed

+58
-144
lines changed

src/compiletest/compiletest.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#[allow(vecs_implicitly_copyable)];
1414
#[allow(non_camel_case_types)];
15-
#[allow(deprecated_mode)];
1615
#[allow(deprecated_pattern)];
1716

1817
extern mod std(vers = "0.7-pre");

src/libcore/comm.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Message passing
1313
*/
1414

1515
use cast::{transmute, transmute_mut};
16-
use cast;
1716
use either::{Either, Left, Right};
1817
use kinds::Owned;
1918
use option::{Option, Some, None};
@@ -150,7 +149,7 @@ impl<T: Owned> GenericChan<T> for Chan<T> {
150149
#[inline(always)]
151150
fn send(&self, x: T) {
152151
unsafe {
153-
let mut self_endp = transmute_mut(&self.endp);
152+
let self_endp = transmute_mut(&self.endp);
154153
let endp = replace(self_endp, None);
155154
*self_endp = Some(streamp::client::data(endp.unwrap(), x))
156155
}
@@ -161,7 +160,7 @@ impl<T: Owned> GenericSmartChan<T> for Chan<T> {
161160
#[inline(always)]
162161
fn try_send(&self, x: T) -> bool {
163162
unsafe {
164-
let mut self_endp = transmute_mut(&self.endp);
163+
let self_endp = transmute_mut(&self.endp);
165164
let endp = replace(self_endp, None);
166165
match streamp::client::try_data(endp.unwrap(), x) {
167166
Some(next) => {
@@ -178,7 +177,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
178177
#[inline(always)]
179178
fn recv(&self) -> T {
180179
unsafe {
181-
let mut self_endp = transmute_mut(&self.endp);
180+
let self_endp = transmute_mut(&self.endp);
182181
let endp = replace(self_endp, None);
183182
let streamp::data(x, endp) = recv(endp.unwrap());
184183
*self_endp = Some(endp);
@@ -189,7 +188,7 @@ impl<T: Owned> GenericPort<T> for Port<T> {
189188
#[inline(always)]
190189
fn try_recv(&self) -> Option<T> {
191190
unsafe {
192-
let mut self_endp = transmute_mut(&self.endp);
191+
let self_endp = transmute_mut(&self.endp);
193192
let endp = replace(self_endp, None);
194193
match try_recv(endp.unwrap()) {
195194
Some(streamp::data(x, endp)) => {
@@ -206,7 +205,7 @@ impl<T: Owned> Peekable<T> for Port<T> {
206205
#[inline(always)]
207206
fn peek(&self) -> bool {
208207
unsafe {
209-
let mut self_endp = transmute_mut(&self.endp);
208+
let self_endp = transmute_mut(&self.endp);
210209
let mut endp = replace(self_endp, None);
211210
let peek = match endp {
212211
Some(ref mut endp) => peek(endp),
@@ -220,12 +219,10 @@ impl<T: Owned> Peekable<T> for Port<T> {
220219
221220
impl<T: Owned> Selectable for Port<T> {
222221
fn header(&mut self) -> *mut PacketHeader {
223-
unsafe {
224222
match self.endp {
225223
Some(ref mut endp) => endp.header(),
226224
None => fail!(~"peeking empty stream")
227225
}
228-
}
229226
}
230227
}
231228
@@ -259,7 +256,7 @@ pub impl<T: Owned> PortSet<T> {
259256
impl<T:Owned> GenericPort<T> for PortSet<T> {
260257
fn try_recv(&self) -> Option<T> {
261258
unsafe {
262-
let mut self_ports = transmute_mut(&self.ports);
259+
let self_ports = transmute_mut(&self.ports);
263260
let mut result = None;
264261
// we have to swap the ports array so we aren't borrowing
265262
// aliasable mutable memory.
@@ -351,7 +348,7 @@ pub mod oneshot {
351348
pub fn init<T: Owned>() -> (client::Oneshot<T>, server::Oneshot<T>) {
352349
pub use core::pipes::HasBuffer;
353350
354-
let mut buffer = ~::core::pipes::Buffer {
351+
let buffer = ~::core::pipes::Buffer {
355352
header: ::core::pipes::BufferHeader(),
356353
data: __Buffer {
357354
Oneshot: ::core::pipes::mk_packet::<Oneshot<T>>()

src/libcore/condition.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/*! Condition handling */
1212

1313
use prelude::*;
14-
use task;
1514
use local_data::{local_data_pop, local_data_set};
1615

1716
// helper for transmutation, shown below.

src/libcore/core.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ they contained the following prologue:
6161
#[no_core];
6262

6363
#[deny(non_camel_case_types)];
64-
#[allow(deprecated_mutable_fields)];
6564

6665
// Make core testable by not duplicating lang items. See #2912
6766
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");

src/libcore/os.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use option::{Some, None};
3636
use prelude::*;
3737
use ptr;
3838
use str;
39-
use task;
4039
use uint;
4140
use unstable::finally::Finally;
4241
use vec;

src/libcore/pipes.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pub fn send<T,Tbuffer>(mut p: SendPacketBuffered<T,Tbuffer>,
348348
payload: T)
349349
-> bool {
350350
let header = p.header();
351-
let mut p_ = p.unwrap();
351+
let p_ = p.unwrap();
352352
let p = unsafe { &mut *p_ };
353353
assert!(ptr::to_unsafe_ptr(&(p.header)) == header);
354354
assert!(p.payload.is_none());
@@ -405,10 +405,8 @@ a message, or `Some(T)` if a message was received.
405405
*/
406406
pub fn try_recv<T:Owned,Tbuffer:Owned>(mut p: RecvPacketBuffered<T, Tbuffer>)
407407
-> Option<T> {
408-
let mut p_ = p.unwrap();
409-
let mut p = unsafe {
410-
&mut *p_
411-
};
408+
let p_ = p.unwrap();
409+
let p = unsafe { &mut *p_ };
412410
413411
do (|| {
414412
try_recv_(p)

src/libcore/rand.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ fn main () {
4343
use int;
4444
use prelude::*;
4545
use str;
46-
use task;
4746
use u32;
4847
use uint;
4948
use util;

src/libcore/reflect.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
409409
disr_val: int,
410410
n_fields: uint,
411411
name: &str) -> bool {
412-
self.inner.push_ptr(); // NOTE remove after next snapshot
413412
if ! self.inner.visit_enter_enum_variant(variant, disr_val,
414413
n_fields, name) {
415414
return false;
@@ -433,7 +432,6 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
433432
n_fields, name) {
434433
return false;
435434
}
436-
self.inner.pop_ptr(); // NOTE remove after next snapshot
437435
true
438436
}
439437

src/libcore/rt/uv/net.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ pub impl StreamWatcher {
152152
extern fn close_cb(handle: *uvll::uv_stream_t) {
153153
let mut stream_watcher: StreamWatcher = NativeHandle::from_native_handle(handle);
154154
{
155-
let mut data = get_watcher_data(&mut stream_watcher);
156-
data.close_cb.swap_unwrap()();
155+
get_watcher_data(&mut stream_watcher).close_cb.swap_unwrap()();
157156
}
158157
drop_watcher_data(&mut stream_watcher);
159158
unsafe { free_handle(handle as *c_void) }
@@ -214,8 +213,7 @@ pub impl TcpWatcher {
214213
assert!(get_watcher_data(self).connect_cb.is_none());
215214
get_watcher_data(self).connect_cb = Some(cb);
216215

217-
let mut connect_watcher = ConnectRequest::new();
218-
let connect_handle = connect_watcher.native_handle();
216+
let connect_handle = ConnectRequest::new().native_handle();
219217
match address {
220218
Ipv4(*) => {
221219
do ip4_as_uv_ip4(address) |addr| {

src/libcore/rt/uvio.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ impl Drop for UvEventLoop {
4646
let self = unsafe {
4747
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
4848
};
49-
let mut uv_loop = self.uvio.uv_loop();
50-
uv_loop.close();
49+
self.uvio.uv_loop().close();
5150
}
5251
}
5352

@@ -189,9 +188,8 @@ impl TcpListener for UvTcpListener {
189188
let maybe_stream = if status.is_none() {
190189
let mut server_stream_watcher = server_stream_watcher;
191190
let mut loop_ = loop_from_watcher(&server_stream_watcher);
192-
let mut client_tcp_watcher = TcpWatcher::new(&mut loop_);
193-
let client_tcp_watcher = client_tcp_watcher.as_stream();
194-
// XXX: Need's to be surfaced in interface
191+
let client_tcp_watcher = TcpWatcher::new(&mut loop_).as_stream();
192+
// XXX: Needs to be surfaced in interface
195193
server_stream_watcher.accept(client_tcp_watcher);
196194
Some(~UvStream::new(client_tcp_watcher))
197195
} else {

src/libcore/task/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool)
472472
/*##################################################################*
473473
* Step 1. Get spawner's taskgroup info.
474474
*##################################################################*/
475-
let mut spawner_group: @@mut TCB =
475+
let spawner_group: @@mut TCB =
476476
match local_get(OldHandle(spawner), taskgroup_key!()) {
477477
None => {
478478
// Main task, doing first spawn ever. Lazily initialise

src/librustc/middle/borrowck/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
/*! See doc.rs for a thorough explanation of the borrow checker */
1212

13-
use core;
1413
use core::prelude::*;
1514

1615
use mc = middle::mem_categorization;
@@ -22,6 +21,8 @@ use middle::dataflow::DataFlowOperator;
2221
use util::common::stmt_set;
2322
use util::ppaux::{note_and_explain_region, Repr};
2423

24+
#[cfg(stage0)]
25+
use core; // NOTE: this can be removed after the next snapshot
2526
use core::hashmap::{HashSet, HashMap};
2627
use core::io;
2728
use core::result::{Result};

src/librustc/middle/mem_categorization.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,6 @@ pub impl mem_categorization_ctxt {
571571
}
572572
}
573573

574-
/// The `field_id` parameter is the ID of the enclosing expression or
575-
/// pattern. It is used to determine which variant of an enum is in use.
576574
fn cat_field<N:ast_node>(&self,
577575
node: N,
578576
base_cmt: cmt,

src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use syntax::ast_util::{def_id_of_def, local_def};
6060
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
6161
use syntax::ast_util::{Privacy, Public, Private};
6262
use syntax::ast_util::{variant_visibility_to_privacy, visibility_to_privacy};
63-
use syntax::attr::{attr_metas, contains_name, attrs_contains_name};
63+
use syntax::attr::{attr_metas, contains_name};
6464
use syntax::parse::token::ident_interner;
6565
use syntax::parse::token::special_idents;
6666
use syntax::print::pprust::path_to_str;

src/librustc/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use util::ppaux::Repr;
2828
use util::common::{indenter};
2929
use util::enum_set::{EnumSet, CLike};
3030

31-
use core;
31+
#[cfg(stage0)]
32+
use core; // NOTE: this can be removed after the next snapshot
3233
use core::ptr::to_unsafe_ptr;
3334
use core::to_bytes;
3435
use core::hashmap::{HashMap, HashSet};

src/librustc/middle/typeck/infer/region_inference.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,13 @@ use middle::typeck::infer::cres;
544544
use util::common::indenter;
545545
use util::ppaux::note_and_explain_region;
546546

547+
#[cfg(stage0)]
548+
use core; // NOTE: this can be removed after next snapshot
547549
use core::cell::{Cell, empty_cell};
548550
use core::hashmap::{HashMap, HashSet};
549551
use core::to_bytes;
550552
use core::uint;
551553
use core::vec;
552-
use core;
553554
use syntax::codemap::span;
554555
use syntax::ast;
555556

src/libstd/ebml.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,6 @@ pub mod writer {
634634
use core::vec;
635635
636636
// ebml writing
637-
#[cfg(stage0)]
638-
pub struct Encoder {
639-
writer: @io::Writer,
640-
priv mut size_positions: ~[uint],
641-
}
642-
643-
#[cfg(not(stage0))]
644637
pub struct Encoder {
645638
writer: @io::Writer,
646639
priv size_positions: ~[uint],

src/libstd/fileinput.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ total line count).
9494
}
9595
*/
9696

97-
#[allow(deprecated_mutable_fields)];
98-
9997
use core::io::ReaderUtil;
10098

10199
/**
@@ -212,8 +210,8 @@ impl FileInput {
212210
pub fn next_file(&self) -> bool {
213211
// No more files
214212

215-
// Compiler whines about "illegal borrow unless pure" for
216-
// files.is_empty()
213+
// unsafe block can be removed after the next snapshot
214+
// (next one after 2013-05-03)
217215
if unsafe { self.fi.files.is_empty() } {
218216
self.fi.current_reader = None;
219217
return false;
@@ -337,7 +335,8 @@ impl io::Reader for FileInput {
337335
fn eof(&self) -> bool {
338336
// we've run out of files, and current_reader is either None or eof.
339337

340-
// compiler whines about illegal borrows for files.is_empty()
338+
// unsafe block can be removed after the next snapshot
339+
// (next one after 2013-05-03)
341340
(unsafe { self.fi.files.is_empty() }) &&
342341
match self.fi.current_reader { None => true, Some(r) => r.eof() }
343342

@@ -380,8 +379,7 @@ Fails when attempting to read from a file that can't be opened.
380379
*/
381380
#[cfg(stage0)]
382381
pub fn input(f: &fn(&str) -> bool) {
383-
let mut i = FileInput::from_args();
384-
i.each_line(f);
382+
FileInput::from_args().each_line(f);
385383
}
386384
/**
387385
Iterate directly over the command line arguments (no arguments implies
@@ -391,7 +389,7 @@ Fails when attempting to read from a file that can't be opened.
391389
*/
392390
#[cfg(not(stage0))]
393391
pub fn input(f: &fn(&str) -> bool) -> bool {
394-
let mut i = FileInput::from_args();
392+
let i = FileInput::from_args();
395393
i.each_line(f)
396394
}
397395
@@ -404,8 +402,7 @@ Fails when attempting to read from a file that can't be opened.
404402
*/
405403
#[cfg(stage0)]
406404
pub fn input_state(f: &fn(&str, FileInputState) -> bool) {
407-
let mut i = FileInput::from_args();
408-
i.each_line_state(f);
405+
FileInput::from_args().each_line_state(f);
409406
}
410407
/**
411408
Iterate directly over the command line arguments (no arguments
@@ -416,7 +413,7 @@ Fails when attempting to read from a file that can't be opened.
416413
*/
417414
#[cfg(not(stage0))]
418415
pub fn input_state(f: &fn(&str, FileInputState) -> bool) -> bool {
419-
let mut i = FileInput::from_args();
416+
let i = FileInput::from_args();
420417
i.each_line_state(f)
421418
}
422419
@@ -427,8 +424,7 @@ Fails when attempting to read from a file that can't be opened.
427424
*/
428425
#[cfg(stage0)]
429426
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) {
430-
let mut i = FileInput::from_vec(files);
431-
i.each_line(f);
427+
FileInput::from_vec(files).each_line(f);
432428
}
433429
/**
434430
Iterate over a vector of files (an empty vector implies just `stdin`).
@@ -437,7 +433,7 @@ Fails when attempting to read from a file that can't be opened.
437433
*/
438434
#[cfg(not(stage0))]
439435
pub fn input_vec(files: ~[Option<Path>], f: &fn(&str) -> bool) -> bool {
440-
let mut i = FileInput::from_vec(files);
436+
let i = FileInput::from_vec(files);
441437
i.each_line(f)
442438
}
443439
@@ -450,8 +446,7 @@ Fails when attempting to read from a file that can't be opened.
450446
#[cfg(stage0)]
451447
pub fn input_vec_state(files: ~[Option<Path>],
452448
f: &fn(&str, FileInputState) -> bool) {
453-
let mut i = FileInput::from_vec(files);
454-
i.each_line_state(f);
449+
FileInput::from_vec(files).each_line_state(f);
455450
}
456451
/**
457452
Iterate over a vector of files (an empty vector implies just `stdin`)
@@ -462,7 +457,7 @@ Fails when attempting to read from a file that can't be opened.
462457
#[cfg(not(stage0))]
463458
pub fn input_vec_state(files: ~[Option<Path>],
464459
f: &fn(&str, FileInputState) -> bool) -> bool {
465-
let mut i = FileInput::from_vec(files);
460+
let i = FileInput::from_vec(files);
466461
i.each_line_state(f)
467462
}
468463

0 commit comments

Comments
 (0)