Skip to content

Commit c703758

Browse files
committed
auto merge of #6774 : alexcrichton/rust/silence-warnings, r=catamorphism
Also as a bonus this fixes #6767
2 parents c33258b + 847dbbe commit c703758

36 files changed

+154
-164
lines changed

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ define TEST_RUNNER
284284
# If NO_REBUILD is set then break the dependencies on extra so we can
285285
# test crates without rebuilding std and extra first
286286
ifeq ($(NO_REBUILD),)
287-
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
287+
STDTESTDEP_$(1)_$(2)_$(3) = $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_EXTRALIB_$(2))
288288
else
289289
STDTESTDEP_$(1)_$(2)_$(3) =
290290
endif

src/libextra/arc.rs

-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ mod tests {
510510
use core::prelude::*;
511511
use core::cell::Cell;
512512
use arc::*;
513-
use arc;
514513

515514
#[test]
516515
fn manually_share_arc() {

src/libextra/bitv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ mod tests {
11971197
#[test]
11981198
fn test_from_bytes() {
11991199
let bitv = from_bytes([0b10110110, 0b00000000, 0b11111111]);
1200-
let str = ~"10110110" + ~"00000000" + ~"11111111";
1200+
let str = ~"10110110" + "00000000" + "11111111";
12011201
assert_eq!(bitv.to_str(), str);
12021202
}
12031203

src/libextra/flatpipes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ mod test {
927927
fn test_try_recv_none3<P:BytePort>(loader: PortLoader<P>) {
928928
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
929929
// The control word is followed by garbage
930-
let bytes = CONTINUE.to_vec() + ~[0];
930+
let bytes = CONTINUE.to_vec() + [0];
931931
let port = loader(bytes);
932932
let res: Option<int> = port.try_recv();
933933
assert!(res.is_none());
@@ -951,7 +951,7 @@ mod test {
951951
1, sys::size_of::<u64>()) |len_bytes| {
952952
len_bytes.to_vec()
953953
};
954-
let bytes = CONTINUE.to_vec() + len_bytes + ~[0, 0, 0, 0];
954+
let bytes = CONTINUE.to_vec() + len_bytes + [0, 0, 0, 0];
955955

956956
let port = loader(bytes);
957957

src/libextra/json.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1880,13 +1880,13 @@ mod tests {
18801880
]));
18811881
assert_eq!(result::unwrap(from_str(
18821882
~"{" +
1883-
~"\"a\": 1.0, " +
1884-
~"\"b\": [" +
1885-
~"true," +
1886-
~"\"foo\\nbar\", " +
1887-
~"{ \"c\": {\"d\": null} } " +
1888-
~"]" +
1889-
~"}")),
1883+
"\"a\": 1.0, " +
1884+
"\"b\": [" +
1885+
"true," +
1886+
"\"foo\\nbar\", " +
1887+
"{ \"c\": {\"d\": null} } " +
1888+
"]" +
1889+
"}")),
18901890
mk_object([
18911891
(~"a", Number(1.0f)),
18921892
(~"b", List(~[

src/libextra/net_ip.rs

-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ mod test {
375375
use uv;
376376

377377
use core::result;
378-
use core::vec;
379378

380379
#[test]
381380
fn test_ip_ipv4_parse_and_format_ip() {

src/libextra/sha1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ mod tests {
317317
Test {
318318
input:
319319
~"abcdbcdecdefdefgefghfghighij" +
320-
~"hijkijkljklmklmnlmnomnopnopq",
320+
"hijkijkljklmklmnlmnomnopnopq",
321321
output: ~[
322322
0x84u8, 0x98u8, 0x3Eu8, 0x44u8,
323323
0x1Cu8, 0x3Bu8, 0xD2u8, 0x6Eu8,

src/libextra/sort.rs

-2
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,6 @@ fn shift_vec<T:Copy>(dest: &mut [T],
746746

747747
#[cfg(test)]
748748
mod test_qsort3 {
749-
use core::prelude::*;
750-
751749
use sort::*;
752750

753751
use core::vec;

src/libextra/sync.rs

-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,6 @@ mod tests {
720720

721721
use core::cast;
722722
use core::cell::Cell;
723-
use core::ptr;
724723
use core::result;
725724
use core::task;
726725
use core::vec;

src/libextra/tempfile.rs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ mod tests {
3030
use core::prelude::*;
3131

3232
use tempfile::mkdtemp;
33-
use tempfile;
3433
use core::os;
3534

3635
#[test]

src/libextra/time.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,8 @@ mod tests {
12051205
// abbreviation.
12061206
let rfc822 = local.rfc822();
12071207
let prefix = ~"Fri, 13 Feb 2009 15:31:30 ";
1208-
assert!(rfc822 == prefix + ~"PST" ||
1209-
rfc822 == prefix + ~"Pacific Standard Time");
1208+
assert!(rfc822 == prefix + "PST" ||
1209+
rfc822 == prefix + "Pacific Standard Time");
12101210
12111211
assert_eq!(local.ctime(), ~"Fri Feb 13 15:31:30 2009");
12121212
assert_eq!(local.rfc822z(), ~"Fri, 13 Feb 2009 15:31:30 -0800");

src/libextra/uv_global_loop.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ mod test {
126126
use uv::ll;
127127
use uv_iotask::IoTask;
128128

129-
use core::old_iter;
130129
use core::libc;
131-
use core::ptr;
132130
use core::task;
133131
use core::cast::transmute;
134132
use core::libc::c_void;
@@ -228,7 +226,7 @@ mod test {
228226
for cycles.times {
229227
exit_po.recv();
230228
};
231-
debug!(~"test_stress_gl_uv_global_loop_high_level_global_timer"+
232-
~" exiting successfully!");
229+
debug!("test_stress_gl_uv_global_loop_high_level_global_timer \
230+
exiting successfully!");
233231
}
234232
}

src/libfuzzer/fuzzer.rc

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub fn stash_expr_if(c: @fn(@ast::expr, test_mode)->bool,
139139
e: @ast::expr,
140140
tm: test_mode) {
141141
if c(e, tm) {
142-
*es = *es + ~[e];
142+
*es = *es + [e];
143143
} else {
144144
/* now my indices are wrong :( */
145145
}
@@ -425,7 +425,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
425425
let p = run::process_output(
426426
"/Users/jruderman/scripts/timed_run_rust_program.py",
427427
[exe_filename.to_str()]);
428-
let comb = str::from_bytes(p.output) + ~"\n" + str::from_bytes(p.error);
428+
let comb = str::from_bytes(p.output) + "\n" + str::from_bytes(p.error);
429429
if str::len(comb) > 1u {
430430
error!("comb comb comb: %?", comb);
431431
}

src/librustc/back/rpath.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
174174
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
175175
let install_prefix = env!("CFG_PREFIX");
176176

177-
if install_prefix == ~"" {
177+
if install_prefix == "" {
178178
fail!("rustc compiled without CFG_PREFIX environment variable");
179179
}
180180

src/librustc/driver/driver.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ pub fn build_session_options(binary: @~str,
641641
~"3" => Aggressive,
642642
_ => {
643643
early_error(demitter, ~"optimization level needs " +
644-
~"to be between 0-3")
644+
"to be between 0-3")
645645
}
646646
}
647647
} else { No }
@@ -925,7 +925,6 @@ mod test {
925925
use driver::driver::{build_configuration, build_session};
926926
use driver::driver::{build_session_options, optgroups, str_input};
927927

928-
use extra::getopts::groups::getopts;
929928
use extra::getopts;
930929
use syntax::attr;
931930
use syntax::diagnostic;
@@ -934,7 +933,7 @@ mod test {
934933
#[test]
935934
fn test_switch_implies_cfg_test() {
936935
let matches =
937-
&match getopts(~[~"--test"], optgroups()) {
936+
&match getopts([~"--test"], optgroups()) {
938937
Ok(copy m) => m,
939938
Err(copy f) => fail!("test_switch_implies_cfg_test: %s", getopts::fail_str(f))
940939
};

src/librustc/driver/session.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ mod test {
384384

385385
fn make_crate(with_bin: bool, with_lib: bool) -> @ast::crate {
386386
let mut attrs = ~[];
387-
if with_bin { attrs += ~[make_crate_type_attr(~"bin")]; }
388-
if with_lib { attrs += ~[make_crate_type_attr(~"lib")]; }
387+
if with_bin { attrs += [make_crate_type_attr(~"bin")]; }
388+
if with_lib { attrs += [make_crate_type_attr(~"lib")]; }
389389
@codemap::respan(codemap::dummy_sp(), ast::crate_ {
390390
module: ast::_mod { view_items: ~[], items: ~[] },
391391
attrs: attrs,

src/librustc/lib/llvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ pub fn type_to_str_inner(names: @TypeNames, outer0: &[TypeRef], ty: TypeRef)
19801980
let mut s = ~"";
19811981
let mut first: bool = true;
19821982
for tys.each |t| {
1983-
if first { first = false; } else { s += ~", "; }
1983+
if first { first = false; } else { s += ", "; }
19841984
s += type_to_str_inner(names, outer, *t).to_owned();
19851985
}
19861986
// [Note at-str] FIXME #2543: Could rewrite this without the copy,

src/librustc/middle/trans/shape.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Although these two functions are never called, they are here
6666
for a VERY GOOD REASON. See #3670
6767
*/
6868
pub fn add_u16(dest: &mut ~[u8], val: u16) {
69-
*dest += ~[(val & 0xffu16) as u8, (val >> 8u16) as u8];
69+
*dest += [(val & 0xffu16) as u8, (val >> 8u16) as u8];
7070
}
7171

7272
pub fn add_substr(dest: &mut ~[u8], src: ~[u8]) {

src/librustc/rustc.rc

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub fn version(argv0: &str) {
157157
pub fn usage(argv0: &str) {
158158
let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0);
159159
io::println(groups::usage(message, optgroups()) +
160-
~"Additional help:
160+
"Additional help:
161161
-W help Print 'lint' options and default settings
162162
-Z help Print internal options for debugging rustc
163163
");

src/librustdoc/attr_parser.rs

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ mod test {
7878
fn parse_attributes(source: ~str) -> ~[ast::attribute] {
7979
use syntax::parse;
8080
use syntax::parse::attr::parser_attr;
81-
use syntax::codemap;
8281

8382
let parse_sess = syntax::parse::new_parse_sess(None);
8483
let parser = parse::new_parser_from_source_str(

src/librustdoc/desc_to_brief_pass.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ pub fn paragraphs(s: &str) -> ~[~str] {
166166
accum = if str::is_empty(accum) {
167167
copy *line
168168
} else {
169-
accum + ~"\n" + *line
169+
accum + "\n" + *line
170170
}
171171
}
172172

173173
res
174174
};
175175

176176
if !accum.is_empty() {
177-
paras + ~[accum]
177+
paras + [accum]
178178
} else {
179179
paras
180180
}

src/librustdoc/markdown_pass.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str {
171171
}
172172

173173
pub fn header_name(doc: doc::ItemTag) -> ~str {
174-
let fullpath = str::connect(doc.path() + ~[doc.name()], "::");
174+
let fullpath = str::connect(doc.path() + [doc.name()], "::");
175175
match &doc {
176176
&doc::ModTag(_) if doc.id() != syntax::ast::crate_node_id => {
177177
fullpath
@@ -190,9 +190,9 @@ pub fn header_name(doc: doc::ItemTag) -> ~str {
190190
let mut trait_part = ~"";
191191
for doc.trait_types.eachi |i, trait_type| {
192192
if i == 0 {
193-
trait_part += ~" of ";
193+
trait_part += " of ";
194194
} else {
195-
trait_part += ~", ";
195+
trait_part += ", ";
196196
}
197197
trait_part += *trait_type;
198198
}
@@ -668,7 +668,7 @@ mod test {
668668
assert!(str::contains(markdown, "% Crate core"));
669669
}
670670
doc::ItemPage(_) => {
671-
assert!(str::contains(markdown, ~"% Module a"));
671+
assert!(str::contains(markdown, "% Module a"));
672672
}
673673
}
674674
}

src/librustdoc/markdown_writer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl WriterUtils for Writer {
3838
}
3939

4040
fn put_line(&self, str: ~str) {
41-
self.put_str(str + ~"\n");
41+
self.put_str(str + "\n");
4242
}
4343

4444
fn put_done(&self) {
@@ -159,7 +159,7 @@ pub fn make_filename(
159159
}
160160
}
161161
doc::ItemPage(doc) => {
162-
str::connect(doc.path() + ~[doc.name()], "_")
162+
str::connect(doc.path() + [doc.name()], "_")
163163
}
164164
}
165165
};

src/librustdoc/page_pass.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn make_doc_from_pages(page_port: &PagePort) -> doc::Doc {
6969
loop {
7070
let val = page_port.recv();
7171
if val.is_some() {
72-
pages += ~[val.unwrap()];
72+
pages += [val.unwrap()];
7373
} else {
7474
break;
7575
}

src/librustdoc/pass.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn test_run_passes() {
4848
doc::CratePage(doc::CrateDoc{
4949
topmod: doc::ModDoc{
5050
item: doc::ItemDoc {
51-
name: doc.cratemod().name() + ~"two",
51+
name: doc.cratemod().name() + "two",
5252
.. copy doc.cratemod().item
5353
},
5454
items: ~[],
@@ -67,7 +67,7 @@ fn test_run_passes() {
6767
doc::CratePage(doc::CrateDoc{
6868
topmod: doc::ModDoc{
6969
item: doc::ItemDoc {
70-
name: doc.cratemod().name() + ~"three",
70+
name: doc.cratemod().name() + "three",
7171
.. copy doc.cratemod().item
7272
},
7373
items: ~[],

src/librustdoc/sectionalize_pass.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
113113
match parse_header(copy *line) {
114114
Some(header) => {
115115
if current_section.is_some() {
116-
sections += ~[(&current_section).get()];
116+
sections += [(&current_section).get()];
117117
}
118118
current_section = Some(doc::Section {
119119
header: header,
@@ -124,14 +124,14 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
124124
match copy current_section {
125125
Some(section) => {
126126
current_section = Some(doc::Section {
127-
body: section.body + ~"\n" + *line,
127+
body: section.body + "\n" + *line,
128128
.. section
129129
});
130130
}
131131
None => {
132132
new_desc = match copy new_desc {
133133
Some(desc) => {
134-
Some(desc + ~"\n" + *line)
134+
Some(desc + "\n" + *line)
135135
}
136136
None => {
137137
Some(copy *line)
@@ -144,7 +144,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
144144
}
145145

146146
if current_section.is_some() {
147-
sections += ~[current_section.get()];
147+
sections += [current_section.get()];
148148
}
149149

150150
(new_desc, sections)

src/librusti/rusti.rc

+6-6
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
272272
~"help" => {
273273
io::println(
274274
~":{\\n ..lines.. \\n:}\\n - execute multiline command\n" +
275-
~":load <crate> ... - \
275+
":load <crate> ... - \
276276
loads given crates as dynamic libraries\n" +
277-
~":clear - clear the bindings\n" +
278-
~":exit - exit from the repl\n" +
279-
~":help - show this message");
277+
":clear - clear the bindings\n" +
278+
":exit - exit from the repl\n" +
279+
":help - show this message");
280280
}
281281
~"load" => {
282282
let mut loaded_crates: ~[~str] = ~[];
@@ -317,10 +317,10 @@ fn run_cmd(repl: &mut Repl, _in: @io::Reader, _out: @io::Writer,
317317
match get_line(use_rl, "rusti| ") {
318318
None => fail!("unterminated multiline command :{ .. :}"),
319319
Some(line) => {
320-
if str::trim(line) == ~":}" {
320+
if str::trim(line) == ":}" {
321321
end_multiline = true;
322322
} else {
323-
multiline_cmd += line + ~"\n";
323+
multiline_cmd += line + "\n";
324324
}
325325
}
326326
}

0 commit comments

Comments
 (0)