for attr in i.attrs.iter() {
match attr {
&clean::NameValue(ref x, ref s) if "doc" == *x => avec.push(
- clean::NameValue(~"doc", unindent(*s))),
+ clean::NameValue("doc".to_owned(), unindent(*s))),
x => avec.push(x.clone())
}
}
_ => true
}).map(|x| x.clone()).collect();
if docstr.len() > 0 {
- a.push(clean::NameValue(~"doc", docstr.into_owned()));
+ a.push(clean::NameValue("doc".to_owned(), docstr.into_owned()));
}
i.attrs = a;
self.fold_item_recur(i)
#[test]
fn should_unindent() {
- let s = ~" line1\n line2";
+ let s = " line1\n line2".to_owned();
let r = unindent(s);
- assert_eq!(r, ~"line1\nline2");
+ assert_eq!(r, "line1\nline2".to_owned());
}
#[test]
fn should_unindent_multiple_paragraphs() {
- let s = ~" line1\n\n line2";
+ let s = " line1\n\n line2".to_owned();
let r = unindent(s);
- assert_eq!(r, ~"line1\n\nline2");
+ assert_eq!(r, "line1\n\nline2".to_owned());
}
#[test]
fn should_leave_multiple_indent_levels() {
// Line 2 is indented another level beyond the
// base indentation and should be preserved
- let s = ~" line1\n\n line2";
+ let s = " line1\n\n line2".to_owned();
let r = unindent(s);
- assert_eq!(r, ~"line1\n\n line2");
+ assert_eq!(r, "line1\n\n line2".to_owned());
}
#[test]
//
// #[doc = "Start way over here
// and continue here"]
- let s = ~"line1\n line2";
+ let s = "line1\n line2".to_owned();
let r = unindent(s);
- assert_eq!(r, ~"line1\nline2");
+ assert_eq!(r, "line1\nline2".to_owned());
}
#[test]
fn should_not_ignore_first_line_indent_in_a_single_line_para() {
- let s = ~"line1\n\n line2";
+ let s = "line1\n\n line2".to_owned();
let r = unindent(s);
- assert_eq!(r, ~"line1\n\n line2");
+ assert_eq!(r, "line1\n\n line2".to_owned());
}
}