Skip to content

Commit fe7ce8c

Browse files
committed
Warnings cleanup
1 parent bb43a4e commit fe7ce8c

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

macros/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#![crate_type="dylib"]
1212

1313
#![feature(plugin_registrar, quote, int_uint, box_syntax)]
14+
#![deny(warnings)]
1415
#![allow(unused_imports)] // for quotes
16+
#![allow(unstable)]
1517

1618
extern crate core;
1719
extern crate syntax;

shared/repr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub const MAX_INLINE_LEN: usize = 7;
3030

3131
// Atoms use a compact representation which fits this enum in a single u64.
3232
// Inlining avoids actually constructing the unpacked representation in memory.
33+
#[allow(missing_copy_implementations)]
3334
pub enum UnpackedAtom {
3435
/// Pointer to a dynamic table entry. Must be 16-byte aligned!
3536
Dynamic(*mut ()),
@@ -123,7 +124,7 @@ pub unsafe fn inline_orig_bytes<'a>(data: &'a u64) -> &'a [u8] {
123124
match UnpackedAtom::from_packed(*data) {
124125
Inline(len, _) => {
125126
let src: &[u8] = mem::transmute(inline_atom_slice(data));
126-
src.slice_to(len as uint)
127+
src.slice_to(len as usize)
127128
}
128129
_ => intrinsics::unreachable(),
129130
}

src/atom/bench.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ macro_rules! check_type (($name:ident, $x:expr, $p:pat) => (
4949
macro_rules! bench_tiny_op (($name:ident, $op:ident, $ctor_x:expr, $ctor_y:expr) => (
5050
#[bench]
5151
fn $name(b: &mut Bencher) {
52-
const n: uint = 1000;
52+
const n: usize = 1000;
5353
let xs: Vec<_> = repeat($ctor_x).take(n).collect();
5454
let ys: Vec<_> = repeat($ctor_y).take(n).collect();
5555

@@ -92,7 +92,7 @@ macro_rules! bench_one (
9292
fn as_slice_x_1000(b: &mut Bencher) {
9393
let x = $x;
9494
b.iter(|| {
95-
for _ in range(0, 1000u) {
95+
for _ in range(0, 1000) {
9696
black_box(x.as_slice());
9797
}
9898
});
@@ -104,7 +104,7 @@ macro_rules! bench_one (
104104
fn clone_x_1000(b: &mut Bencher) {
105105
let x = $x;
106106
b.iter(|| {
107-
for _ in range(0, 1000u) {
107+
for _ in range(0, 1000) {
108108
black_box(x.clone());
109109
}
110110
});
@@ -116,7 +116,7 @@ macro_rules! bench_one (
116116
fn clone_x_1000(b: &mut Bencher) {
117117
let x = $x.to_string();
118118
b.iter(|| {
119-
for _ in range(0, 1000u) {
119+
for _ in range(0, 1000) {
120120
black_box(x.clone());
121121
}
122122
});

src/atom/mod.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use alloc::heap;
2424
use alloc::boxed::Box;
2525
use collections::string::String;
2626
use std::cmp::Ordering::{self, Equal};
27-
use std::hash::{Hash, Hasher};
27+
use std::hash::Hash;
2828
use std::sync::Mutex;
2929
use std::sync::atomic::AtomicInt;
3030
use std::sync::atomic::Ordering::SeqCst;
@@ -41,7 +41,7 @@ macro_rules! log (($e:expr) => (()));
4141
pub mod repr;
4242

4343
// Needed for memory safety of the tagging scheme!
44-
const ENTRY_ALIGNMENT: uint = 16;
44+
const ENTRY_ALIGNMENT: usize = 16;
4545

4646
// Macro-generated table for static atoms.
4747
static static_atom_set: OrderedSet<&'static str> = static_atom_set!();
@@ -83,7 +83,7 @@ impl StringCache {
8383

8484
fn add(&mut self, string_to_add: &str) -> *mut StringCacheEntry {
8585
let hash = xxhash::hash(&string_to_add);
86-
let bucket_index = (hash & (self.buckets.len()-1) as u64) as uint;
86+
let bucket_index = (hash & (self.buckets.len()-1) as u64) as usize;
8787
let mut ptr = self.buckets[bucket_index];
8888

8989
while ptr != ptr::null_mut() {
@@ -132,7 +132,7 @@ impl StringCache {
132132

133133
debug_assert!(value.ref_count.load(SeqCst) == 0);
134134

135-
let bucket_index = (value.hash & (self.buckets.len()-1) as u64) as uint;
135+
let bucket_index = (value.hash & (self.buckets.len()-1) as u64) as usize;
136136

137137
let mut current = self.buckets[bucket_index];
138138
let mut prev: *mut StringCacheEntry = ptr::null_mut();
@@ -204,7 +204,7 @@ impl Atom {
204204
let buf = repr::inline_orig_bytes(&self.data);
205205
str::from_utf8(buf).unwrap()
206206
},
207-
Static(idx) => *static_atom_set.iter().idx(idx as uint).expect("bad static atom"),
207+
Static(idx) => *static_atom_set.iter().idx(idx as usize).expect("bad static atom"),
208208
Dynamic(entry) => {
209209
let entry = entry as *mut StringCacheEntry;
210210
(*entry).string.as_slice()
@@ -485,22 +485,22 @@ mod tests {
485485

486486
#[test]
487487
fn match_atom() {
488-
assert_eq!(2u, match Atom::from_slice("head") {
489-
atom!(br) => 1u,
490-
atom!(html) | atom!(head) => 2u,
491-
_ => 3u,
488+
assert_eq!(2, match Atom::from_slice("head") {
489+
atom!(br) => 1,
490+
atom!(html) | atom!(head) => 2,
491+
_ => 3,
492492
});
493493

494-
assert_eq!(3u, match Atom::from_slice("body") {
495-
atom!(br) => 1u,
496-
atom!(html) | atom!(head) => 2u,
497-
_ => 3u,
494+
assert_eq!(3, match Atom::from_slice("body") {
495+
atom!(br) => 1,
496+
atom!(html) | atom!(head) => 2,
497+
_ => 3,
498498
});
499499

500-
assert_eq!(3u, match Atom::from_slice("zzzzzz") {
501-
atom!(br) => 1u,
502-
atom!(html) | atom!(head) => 2u,
503-
_ => 3u,
500+
assert_eq!(3, match Atom::from_slice("zzzzzz") {
501+
atom!(br) => 1,
502+
atom!(html) | atom!(head) => 2,
503+
_ => 3,
504504
});
505505
}
506506
}

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#![feature(plugin, old_orphan_check)]
1414
#![no_std]
15+
#![deny(warnings)]
16+
#![allow(unstable)]
1517

1618
#[macro_use]
1719
extern crate core;

0 commit comments

Comments
 (0)