Skip to content

Commit f7d86b2

Browse files
author
Jakub Wieczorek
committed
Remove the dead code identified by the new lint
1 parent 0271224 commit f7d86b2

File tree

35 files changed

+61
-146
lines changed

35 files changed

+61
-146
lines changed

src/libglob/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ use std::string::String;
4444
* pattern - see the `glob` function for more details.
4545
*/
4646
pub struct Paths {
47-
root: Path,
4847
dir_patterns: Vec<Pattern>,
4948
require_dir: bool,
5049
options: MatchOptions,
@@ -108,7 +107,6 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Paths {
108107
// FIXME: How do we want to handle verbatim paths? I'm inclined to return nothing,
109108
// since we can't very well find all UNC shares with a 1-letter server name.
110109
return Paths {
111-
root: root,
112110
dir_patterns: Vec::new(),
113111
require_dir: false,
114112
options: options,
@@ -134,7 +132,6 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Paths {
134132
}
135133

136134
Paths {
137-
root: root,
138135
dir_patterns: dir_patterns,
139136
require_dir: require_dir,
140137
options: options,

src/libnative/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
152152
/// Implementation of rt::rtio's IoFactory trait to generate handles to the
153153
/// native I/O functionality.
154154
pub struct IoFactory {
155-
cannot_construct_outside_of_this_module: ()
155+
_cannot_construct_outside_of_this_module: ()
156156
}
157157

158158
impl IoFactory {
159159
pub fn new() -> IoFactory {
160160
net::init();
161-
IoFactory { cannot_construct_outside_of_this_module: () }
161+
IoFactory { _cannot_construct_outside_of_this_module: () }
162162
}
163163
}
164164

src/libnative/io/net.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,10 @@ pub struct TcpStream {
254254

255255
struct Inner {
256256
fd: sock_t,
257-
lock: mutex::NativeMutex,
257+
258+
// Unused on Linux, where this lock is not necessary.
259+
#[allow(dead_code)]
260+
lock: mutex::NativeMutex
258261
}
259262

260263
pub struct Guard<'a> {

src/libnative/io/pipe_unix.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ fn addr_to_sockaddr_un(addr: &CString) -> IoResult<(libc::sockaddr_storage, uint
5858

5959
struct Inner {
6060
fd: fd_t,
61-
lock: mutex::NativeMutex,
61+
62+
// Unused on Linux, where this lock is not necessary.
63+
#[allow(dead_code)]
64+
lock: mutex::NativeMutex
6265
}
6366

6467
impl Inner {

src/librand/distributions/gamma.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ struct GammaSmallShape {
8181
/// See `Gamma` for sampling from a Gamma distribution with general
8282
/// shape parameters.
8383
struct GammaLargeShape {
84-
shape: f64,
8584
scale: f64,
8685
c: f64,
8786
d: f64
@@ -118,7 +117,6 @@ impl GammaLargeShape {
118117
fn new_raw(shape: f64, scale: f64) -> GammaLargeShape {
119118
let d = shape - 1. / 3.;
120119
GammaLargeShape {
121-
shape: shape,
122120
scale: scale,
123121
c: 1. / (9. * d).sqrt(),
124122
d: d

src/librustc/front/std_inject.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ fn inject_crates_ref(sess: &Session, krate: ast::Crate) -> ast::Crate {
130130
fold.fold_crate(krate)
131131
}
132132

133-
struct PreludeInjector<'a> {
134-
sess: &'a Session,
135-
}
133+
struct PreludeInjector<'a>;
136134

137135

138136
impl<'a> fold::Folder for PreludeInjector<'a> {
@@ -223,9 +221,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
223221
}
224222
}
225223

226-
fn inject_prelude(sess: &Session, krate: ast::Crate) -> ast::Crate {
227-
let mut fold = PreludeInjector {
228-
sess: sess,
229-
};
224+
fn inject_prelude(_: &Session, krate: ast::Crate) -> ast::Crate {
225+
let mut fold = PreludeInjector;
230226
fold.fold_crate(krate)
231227
}

src/librustc/metadata/loader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub struct Library {
8686
}
8787

8888
pub struct ArchiveMetadata {
89-
archive: ArchiveRO,
89+
_archive: ArchiveRO,
9090
// See comments in ArchiveMetadata::new for why this is static
9191
data: &'static [u8],
9292
}
@@ -487,7 +487,7 @@ impl ArchiveMetadata {
487487
unsafe { mem::transmute(data) }
488488
};
489489
Some(ArchiveMetadata {
490-
archive: ar,
490+
_archive: ar,
491491
data: data,
492492
})
493493
}

src/librustc/metadata/tyencode.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ pub struct ctxt<'a> {
4242
// Extra parameters are for converting to/from def_ids in the string rep.
4343
// Whatever format you choose should not contain pipe characters.
4444
pub struct ty_abbrev {
45-
pos: uint,
46-
len: uint,
4745
s: String
4846
}
4947

@@ -68,8 +66,6 @@ pub fn enc_ty(w: &mut MemWriter, cx: &ctxt, t: ty::t) {
6866
if abbrev_len < len {
6967
// I.e. it's actually an abbreviation.
7068
cx.abbrevs.borrow_mut().insert(t, ty_abbrev {
71-
pos: pos as uint,
72-
len: len as uint,
7369
s: format!("\\#{:x}:{:x}\\#", pos, len)
7470
});
7571
}

src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
2929
cause: euv::LoanCause,
3030
cmt: mc::cmt,
3131
loan_region: ty::Region,
32-
loan_kind: ty::BorrowKind)
32+
_: ty::BorrowKind)
3333
-> Result<(),()> {
3434
debug!("guarantee_lifetime(cmt={}, loan_region={})",
3535
cmt.repr(bccx.tcx), loan_region.repr(bccx.tcx));
@@ -38,7 +38,6 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
3838
span: span,
3939
cause: cause,
4040
loan_region: loan_region,
41-
loan_kind: loan_kind,
4241
cmt_original: cmt.clone()};
4342
ctxt.check(&cmt, None)
4443
}
@@ -55,7 +54,6 @@ struct GuaranteeLifetimeContext<'a> {
5554
span: Span,
5655
cause: euv::LoanCause,
5756
loan_region: ty::Region,
58-
loan_kind: ty::BorrowKind,
5957
cmt_original: mc::cmt
6058
}
6159

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ impl<'a> GatherLoanCtxt<'a> {
310310
Loan {
311311
index: self.all_loans.len(),
312312
loan_path: loan_path,
313-
cmt: cmt,
314313
kind: req_kind,
315314
gen_scope: gen_scope,
316315
kill_scope: kill_scope,
@@ -481,8 +480,7 @@ impl<'a> GatherLoanCtxt<'a> {
481480
/// This visitor walks static initializer's expressions and makes
482481
/// sure the loans being taken are sound.
483482
struct StaticInitializerCtxt<'a> {
484-
bccx: &'a BorrowckCtxt<'a>,
485-
item_ub: ast::NodeId,
483+
bccx: &'a BorrowckCtxt<'a>
486484
}
487485

488486
impl<'a> visit::Visitor<()> for StaticInitializerCtxt<'a> {
@@ -509,8 +507,7 @@ pub fn gather_loans_in_static_initializer(bccx: &mut BorrowckCtxt, expr: &ast::E
509507
debug!("gather_loans_in_static_initializer(expr={})", expr.repr(bccx.tcx));
510508

511509
let mut sicx = StaticInitializerCtxt {
512-
bccx: bccx,
513-
item_ub: expr.id,
510+
bccx: bccx
514511
};
515512

516513
sicx.visit_expr(expr, ());

0 commit comments

Comments
 (0)