1
Fork 0

librustdoc: Remove all ~str usage from librustdoc.

This commit is contained in:
Patrick Walton 2014-05-12 13:44:59 -07:00
parent 6559a3675e
commit 9ba91e1243
13 changed files with 357 additions and 261 deletions

View file

@ -25,7 +25,7 @@ use html::escape::Escape;
use t = syntax::parse::token;
/// Highlights some source code, returning the HTML output.
pub fn highlight(src: &str, class: Option<&str>) -> ~str {
pub fn highlight(src: &str, class: Option<&str>) -> StrBuf {
let sess = parse::new_parse_sess();
let fm = parse::string_to_filemap(&sess,
src.to_strbuf(),
@ -36,7 +36,7 @@ pub fn highlight(src: &str, class: Option<&str>) -> ~str {
lexer::new_string_reader(&sess.span_diagnostic, fm),
class,
&mut out).unwrap();
str::from_utf8_lossy(out.unwrap().as_slice()).into_owned()
str::from_utf8_lossy(out.unwrap().as_slice()).to_strbuf()
}
/// Exhausts the `lexer` writing the output into `out`.