use core::io;
use core::os;
-use core::str;
use core::uint;
use core::vec;
use syntax::ast_map;
use syntax;
-#[cfg(test)] use core::vec;
-
pub struct Ctxt {
ast: @ast::crate,
ast_map: ast_map::map
}
});
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()
}
}
}
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, ~"")
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);
use doc;
use extract;
use page_pass::run;
- use core::vec;
fn mk_doc_(
output_style: config::OutputStyle,
#[test]
fn should_prune_hidden_items() {
- use core::vec;
-
let doc = mk_doc(~"#[doc(hidden)] mod a { }");
assert!(doc.cratemod().mods().is_empty())
}
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| {
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(), ~"");
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),
}
}
(None, None) => {
host = None;
device = None;
- rest = str::to_owned(s);
+ rest = s.to_owned();
}
}
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),
}
}
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);
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);
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);
*
* # 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")
*
* # 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")
*
* # 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")