std: test-fixes, remove warnings, syntax highlighting for code examples.

This commit is contained in:
Huon Wilson 2013-06-14 13:43:05 +10:00
parent 4686ed1a1d
commit ee25cf8d75
11 changed files with 12 additions and 28 deletions

View File

@ -24,7 +24,6 @@ use util::logv;
use core::io;
use core::os;
use core::str;
use core::uint;
use core::vec;

View File

@ -32,8 +32,6 @@ use syntax::ast;
use syntax::ast_map;
use syntax;
#[cfg(test)] use core::vec;
pub struct Ctxt {
ast: @ast::crate,
ast_map: ast_map::map

View File

@ -129,14 +129,12 @@ fn first_sentence_(s: &str) -> ~str {
}
});
match idx {
Some(idx) if idx > 2u => {
str::to_owned(s.slice(0, idx - 1))
}
Some(idx) if idx > 2u => s.slice(0, idx - 1).to_owned(),
_ => {
if s.ends_with(".") {
str::to_owned(s)
s.to_owned()
} else {
str::to_owned(s)
s.to_owned()
}
}
}

View File

@ -285,8 +285,6 @@ mod test {
use extract::{extract, from_srv};
use parse;
use core::vec;
fn mk_doc(source: @str) -> doc::Doc {
let ast = parse::from_str(source);
extract(ast, ~"")

View File

@ -537,8 +537,6 @@ mod test {
use tystr_pass;
use unindent_pass;
use core::str;
fn render(source: ~str) -> ~str {
let (srv, doc) = create_doc_srv(source);
let markdown = write_markdown_str_srv(srv, doc);

View File

@ -157,7 +157,6 @@ mod test {
use doc;
use extract;
use page_pass::run;
use core::vec;
fn mk_doc_(
output_style: config::OutputStyle,

View File

@ -77,8 +77,6 @@ mod test {
#[test]
fn should_prune_hidden_items() {
use core::vec;
let doc = mk_doc(~"#[doc(hidden)] mod a { }");
assert!(doc.cratemod().mods().is_empty())
}

View File

@ -162,7 +162,6 @@ mod test {
use extract;
use tystr_pass;
use prune_private_pass::run;
use core::vec;
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(copy source) |srv| {

View File

@ -170,9 +170,6 @@ mod test {
use extract;
use sectionalize_pass::run;
use core::str;
use core::vec;
fn mk_doc(source: ~str) -> doc::Doc {
do astsrv::from_str(copy source) |srv| {
let doc = extract::from_srv(srv.clone(), ~"");

View File

@ -515,7 +515,7 @@ impl GenericPath for PosixPath {
fn with_filestem(&self, s: &str) -> PosixPath {
match self.filetype() {
None => self.with_filename(s),
Some(ref t) => self.with_filename(str::to_owned(s) + *t),
Some(ref t) => self.with_filename(s.to_owned() + *t),
}
}
@ -657,7 +657,7 @@ impl GenericPath for WindowsPath {
(None, None) => {
host = None;
device = None;
rest = str::to_owned(s);
rest = s.to_owned();
}
}
@ -729,7 +729,7 @@ impl GenericPath for WindowsPath {
fn with_filestem(&self, s: &str) -> WindowsPath {
match self.filetype() {
None => self.with_filename(s),
Some(ref t) => self.with_filename(str::to_owned(s) + *t),
Some(ref t) => self.with_filename(s.to_owned() + *t),
}
}
@ -984,7 +984,7 @@ mod tests {
fn test_posix_paths() {
fn t(wp: &PosixPath, s: &str) {
let ss = wp.to_str();
let sss = str::to_owned(s);
let sss = s.to_owned();
if (ss != sss) {
debug!("got %s", ss);
debug!("expected %s", sss);
@ -1042,7 +1042,7 @@ mod tests {
fn test_normalize() {
fn t(wp: &PosixPath, s: &str) {
let ss = wp.to_str();
let sss = str::to_owned(s);
let sss = s.to_owned();
if (ss != sss) {
debug!("got %s", ss);
debug!("expected %s", sss);
@ -1105,7 +1105,7 @@ mod tests {
fn test_windows_paths() {
fn t(wp: &WindowsPath, s: &str) {
let ss = wp.to_str();
let sss = str::to_owned(s);
let sss = s.to_owned();
if (ss != sss) {
debug!("got %s", ss);
debug!("expected %s", sss);

View File

@ -1432,7 +1432,7 @@ impl<'self> StrSlice<'self> for &'self str {
*
* # Example
*
* ~~~
* ~~~ {.rust}
* assert_eq!("11foo1bar11".trim_chars(&'1'), "foo1bar")
* assert_eq!("12foo1bar12".trim_chars(& &['1', '2']), "foo1bar")
* assert_eq!("123foo1bar123".trim_chars(&|c: char| c.is_digit()), "foo1bar")
@ -1451,7 +1451,7 @@ impl<'self> StrSlice<'self> for &'self str {
*
* # Example
*
* ~~~
* ~~~ {.rust}
* assert_eq!("11foo1bar11".trim_left_chars(&'1'), "foo1bar11")
* assert_eq!("12foo1bar12".trim_left_chars(& &['1', '2']), "foo1bar12")
* assert_eq!("123foo1bar123".trim_left_chars(&|c: char| c.is_digit()), "foo1bar123")
@ -1473,7 +1473,7 @@ impl<'self> StrSlice<'self> for &'self str {
*
* # Example
*
* ~~~
* ~~~ {.rust}
* assert_eq!("11foo1bar11".trim_right_chars(&'1'), "11foo1bar")
* assert_eq!("12foo1bar12".trim_right_chars(& &['1', '2']), "12foo1bar")
* assert_eq!("123foo1bar123".trim_right_chars(&|c: char| c.is_digit()), "123foo1bar")