Skip to content

Commit e6d8426

Browse files
committed
Change functions from taking ~str to taking &str
1 parent 9da641b commit e6d8426

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/librustc/back/link.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,12 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
487487
fn crate_meta_extras_hash(symbol_hasher: &hash::State,
488488
-cmh_items: ~[@ast::meta_item],
489489
dep_hashes: ~[~str]) -> @str {
490-
fn len_and_str(s: ~str) -> ~str {
491-
return fmt!("%u_%s", str::len(s), s);
490+
fn len_and_str(s: &str) -> ~str {
491+
fmt!("%u_%s", s.len(), s)
492492
}
493493

494494
fn len_and_str_lit(l: ast::lit) -> ~str {
495-
return len_and_str(pprust::lit_to_str(@l));
495+
len_and_str(pprust::lit_to_str(@l))
496496
}
497497

498498
let cmh_items = attr::sort_meta_items(cmh_items);
@@ -615,7 +615,7 @@ pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
615615
616616
// Name sanitation. LLVM will happily accept identifiers with weird names, but
617617
// gas doesn't!
618-
pub fn sanitize(s: ~str) -> ~str {
618+
pub fn sanitize(s: &str) -> ~str {
619619
let mut result = ~"";
620620
for str::chars_each(s) |c| {
621621
match c {
@@ -629,10 +629,10 @@ pub fn sanitize(s: ~str) -> ~str {
629629
'a' .. 'z'
630630
| 'A' .. 'Z'
631631
| '0' .. '9'
632-
| '_' => str::push_char(&mut result, c),
632+
| '_' => result.push_char(c),
633633
_ => {
634634
if c > 'z' && char::is_XID_continue(c) {
635-
str::push_char(&mut result, c);
635+
result.push_char(c);
636636
}
637637
}
638638
}

src/libsyntax/parse/comments.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ impl cmp::Eq for cmnt_style {
4646

4747
pub type cmnt = {style: cmnt_style, lines: ~[~str], pos: BytePos};
4848

49-
pub fn is_doc_comment(s: ~str) -> bool {
49+
pub fn is_doc_comment(s: &str) -> bool {
5050
(s.starts_with(~"///") && !is_line_non_doc_comment(s)) ||
5151
s.starts_with(~"//!") ||
5252
(s.starts_with(~"/**") && !is_block_non_doc_comment(s)) ||
5353
s.starts_with(~"/*!")
5454
}
5555
56-
pub fn doc_comment_style(comment: ~str) -> ast::attr_style {
56+
pub fn doc_comment_style(comment: &str) -> ast::attr_style {
5757
assert is_doc_comment(comment);
5858
if comment.starts_with(~"//!") || comment.starts_with(~"/*!") {
5959
ast::attr_inner
@@ -62,7 +62,7 @@ pub fn doc_comment_style(comment: ~str) -> ast::attr_style {
6262
}
6363
}
6464
65-
pub fn strip_doc_comment_decoration(comment: ~str) -> ~str {
65+
pub fn strip_doc_comment_decoration(comment: &str) -> ~str {
6666
6767
/// remove whitespace-only lines from the start/end of lines
6868
fn vertical_trim(lines: ~[~str]) -> ~[~str] {

0 commit comments

Comments
 (0)