Skip to content

Commit 242606c

Browse files
committed
Clean up various warnings throughout the codebase
1 parent 23fbe93 commit 242606c

File tree

6 files changed

+33
-30
lines changed

6 files changed

+33
-30
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ pub fn with_scope(bcx: block,
14281428

14291429
pub fn with_scope_result(bcx: block,
14301430
opt_node_info: Option<NodeInfo>,
1431-
name: &str,
1431+
_name: &str,
14321432
f: &fn(block) -> Result) -> Result {
14331433
let _icx = push_ctxt("with_scope_result");
14341434

src/librustc/middle/trans/callee.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn get_impl_resolutions(bcx: block,
197197
impl_id: ast::def_id)
198198
-> typeck::vtable_res {
199199
if impl_id.crate == ast::local_crate {
200-
*bcx.ccx().maps.vtable_map.get(&impl_id.node)
200+
bcx.ccx().maps.vtable_map.get_copy(&impl_id.node)
201201
} else {
202202
// XXX: This is a temporary hack to work around not properly
203203
// exporting information about resolutions for impls.
@@ -670,15 +670,13 @@ pub fn trans_call_inner(in_cx: block,
670670
None => { assert!(ty::type_is_immediate(bcx.tcx(), ret_ty)) }
671671
Some(expr::Ignore) => {
672672
// drop the value if it is not being saved.
673-
unsafe {
674-
if ty::type_needs_drop(bcx.tcx(), ret_ty) {
675-
if ty::type_is_immediate(bcx.tcx(), ret_ty) {
676-
let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
677-
Store(bcx, llresult, llscratchptr);
678-
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
679-
} else {
680-
bcx = glue::drop_ty(bcx, llretslot, ret_ty);
681-
}
673+
if ty::type_needs_drop(bcx.tcx(), ret_ty) {
674+
if ty::type_is_immediate(bcx.tcx(), ret_ty) {
675+
let llscratchptr = alloc_ty(bcx, ret_ty, "__ret");
676+
Store(bcx, llresult, llscratchptr);
677+
bcx = glue::drop_ty(bcx, llscratchptr, ret_ty);
678+
} else {
679+
bcx = glue::drop_ty(bcx, llretslot, ret_ty);
682680
}
683681
}
684682
}

src/librustc/middle/trans/controlflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ pub fn trans_break_cont(bcx: block,
254254
// Locate closest loop block, outputting cleanup as we go.
255255
let mut unwind = bcx;
256256
let mut cur_scope = unwind.scope;
257-
let mut target = unwind;
257+
let mut target;
258258
loop {
259259
cur_scope = match cur_scope {
260260
Some(@scope_info {

src/librustc/middle/ty.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,25 +3621,29 @@ pub fn trait_method_def_ids(cx: ctxt, id: ast::def_id) -> @~[def_id] {
36213621
}
36223622

36233623
pub fn impl_trait_ref(cx: ctxt, id: ast::def_id) -> Option<@TraitRef> {
3624-
*do cx.impl_trait_cache.find_or_insert_with(id) |_| {
3625-
if id.crate == ast::local_crate {
3626-
debug!("(impl_trait_ref) searching for trait impl %?", id);
3627-
match cx.items.find(&id.node) {
3628-
Some(&ast_map::node_item(@ast::item {
3629-
node: ast::item_impl(_, ref opt_trait, _, _),
3630-
_},
3631-
_)) => {
3632-
match opt_trait {
3633-
&Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
3634-
&None => None
3635-
}
3624+
match cx.impl_trait_cache.find(&id) {
3625+
Some(&ret) => { return ret; }
3626+
None => {}
3627+
}
3628+
let ret = if id.crate == ast::local_crate {
3629+
debug!("(impl_trait_ref) searching for trait impl %?", id);
3630+
match cx.items.find(&id.node) {
3631+
Some(&ast_map::node_item(@ast::item {
3632+
node: ast::item_impl(_, ref opt_trait, _, _),
3633+
_},
3634+
_)) => {
3635+
match opt_trait {
3636+
&Some(ref t) => Some(ty::node_id_to_trait_ref(cx, t.ref_id)),
3637+
&None => None
36363638
}
3637-
_ => None
36383639
}
3639-
} else {
3640-
csearch::get_impl_trait(cx, id)
3640+
_ => None
36413641
}
3642-
}
3642+
} else {
3643+
csearch::get_impl_trait(cx, id)
3644+
};
3645+
cx.impl_trait_cache.insert(id, ret);
3646+
return ret;
36433647
}
36443648

36453649
pub fn ty_to_def_id(ty: t) -> Option<ast::def_id> {

src/librustc/middle/typeck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
303303
let tcx = ccx.tcx;
304304
let main_t = ty::node_id_to_type(tcx, main_id);
305305
match ty::get(main_t).sty {
306-
ty::ty_bare_fn(ref fn_ty) => {
306+
ty::ty_bare_fn(*) => {
307307
match tcx.items.find(&main_id) {
308308
Some(&ast_map::node_item(it,_)) => {
309309
match it.node {

src/libsyntax/ext/pipes/proto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ pub struct protocol_ {
144144
impl protocol_ {
145145
/// Get a state.
146146
pub fn get_state(&self, name: &str) -> state {
147-
*self.states.iter().find_(|i| name == i.name).get()
147+
let mut i = self.states.iter();
148+
*i.find_(|i| name == i.name).get()
148149
}
149150

150151
pub fn get_state_by_id(&self, id: uint) -> state { self.states[id] }

0 commit comments

Comments
 (0)