std: remove str::{len, slice, is_empty} in favour of methods.
This commit is contained in:
parent
b29cd22bce
commit
c32fb53cf9
35 changed files with 185 additions and 207 deletions
|
|
@ -94,7 +94,7 @@ fn parse_desc(desc: ~str) -> Option<~str> {
|
|||
|
||||
match first_sentence(copy desc) {
|
||||
Some(first_sentence) => {
|
||||
if str::len(first_sentence) <= max_brief_len {
|
||||
if first_sentence.len() <= max_brief_len {
|
||||
Some(first_sentence)
|
||||
} else {
|
||||
None
|
||||
|
|
@ -133,7 +133,7 @@ fn first_sentence_(s: &str) -> ~str {
|
|||
};
|
||||
match idx {
|
||||
Some(idx) if idx > 2u => {
|
||||
str::to_owned(str::slice(s, 0, idx - 1))
|
||||
str::to_owned(s.slice(0, idx - 1))
|
||||
}
|
||||
_ => {
|
||||
if str::ends_with(s, ".") {
|
||||
|
|
@ -165,7 +165,7 @@ pub fn paragraphs(s: &str) -> ~[~str] {
|
|||
|
||||
whitespace_lines = 0;
|
||||
|
||||
accum = if str::is_empty(accum) {
|
||||
accum = if accum.is_empty() {
|
||||
copy *line
|
||||
} else {
|
||||
accum + "\n" + *line
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ fn sectionalize(desc: Option<~str>) -> (Option<~str>, ~[doc::Section]) {
|
|||
|
||||
fn parse_header(line: ~str) -> Option<~str> {
|
||||
if str::starts_with(line, "# ") {
|
||||
Some(str::slice(line, 2u, str::len(line)).to_owned())
|
||||
Some(line.slice(2u, line.len()).to_owned())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ fn unindent(s: &str) -> ~str {
|
|||
if str::is_whitespace(*line) {
|
||||
copy *line
|
||||
} else {
|
||||
assert!(str::len(*line) >= min_indent);
|
||||
str::slice(*line, min_indent, str::len(*line)).to_owned()
|
||||
assert!(line.len() >= min_indent);
|
||||
line.slice(min_indent, line.len()).to_owned()
|
||||
}
|
||||
};
|
||||
str::connect(unindented, "\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue