Skip to content

Commit 5c8afbb

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 162259 b: refs/heads/auto c: 39f44c0 h: refs/heads/master i: 162257: f3ff815 162255: 347758f v: v3
1 parent 2036e58 commit 5c8afbb

File tree

8 files changed

+23
-25
lines changed

8 files changed

+23
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 60338d91c4334e5fdfbd37b298cd5b99e8fc0cdd
13+
refs/heads/auto: 39f44c0c20977bc0ff5562d8bca27b11248abbd4
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libsyntax/ast_map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'ast> Map<'ast> {
260260
}
261261

262262
fn find_entry(&self, id: NodeId) -> Option<MapEntry<'ast>> {
263-
self.map.borrow().as_slice().get(id as uint).map(|e| *e)
263+
self.map.borrow().get(id as uint).map(|e| *e)
264264
}
265265

266266
pub fn krate(&self) -> &'ast Crate {

branches/auto/src/libsyntax/codemap.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl FileMap {
290290
lines.get(line_number).map(|&line| {
291291
let begin: BytePos = line - self.start_pos;
292292
let begin = begin.to_uint();
293-
let slice = self.src.as_slice().slice_from(begin);
293+
let slice = self.src.slice_from(begin);
294294
match slice.find('\n') {
295295
Some(e) => slice.slice_to(e),
296296
None => slice
@@ -308,8 +308,8 @@ impl FileMap {
308308
}
309309

310310
pub fn is_real_file(&self) -> bool {
311-
!(self.name.as_slice().starts_with("<") &&
312-
self.name.as_slice().ends_with(">"))
311+
!(self.name.starts_with("<") &&
312+
self.name.ends_with(">"))
313313
}
314314
}
315315

@@ -336,8 +336,8 @@ impl CodeMap {
336336
// Remove utf-8 BOM if any.
337337
// FIXME #12884: no efficient/safe way to remove from the start of a string
338338
// and reuse the allocation.
339-
let mut src = if src.as_slice().starts_with("\ufeff") {
340-
String::from_str(src.as_slice().slice_from(3))
339+
let mut src = if src.starts_with("\ufeff") {
340+
String::from_str(src.slice_from(3))
341341
} else {
342342
String::from_str(src.as_slice())
343343
};
@@ -346,7 +346,7 @@ impl CodeMap {
346346
// This is a workaround to prevent CodeMap.lookup_filemap_idx from accidentally
347347
// overflowing into the next filemap in case the last byte of span is also the last
348348
// byte of filemap, which leads to incorrect results from CodeMap.span_to_*.
349-
if src.len() > 0 && !src.as_slice().ends_with("\n") {
349+
if src.len() > 0 && !src.ends_with("\n") {
350350
src.push('\n');
351351
}
352352

@@ -426,14 +426,14 @@ impl CodeMap {
426426
if begin.fm.start_pos != end.fm.start_pos {
427427
None
428428
} else {
429-
Some(begin.fm.src.as_slice().slice(begin.pos.to_uint(),
430-
end.pos.to_uint()).to_string())
429+
Some(begin.fm.src.slice(begin.pos.to_uint(),
430+
end.pos.to_uint()).to_string())
431431
}
432432
}
433433

434434
pub fn get_filemap(&self, filename: &str) -> Rc<FileMap> {
435435
for fm in self.files.borrow().iter() {
436-
if filename == fm.name.as_slice() {
436+
if filename == fm.name {
437437
return fm.clone();
438438
}
439439
}

branches/auto/src/libsyntax/ext/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ impl<'a> ExtCtxt<'a> {
527527
let mut call_site = None;
528528
loop {
529529
let expn_info = self.codemap().with_expn_info(expn_id, |ei| {
530-
ei.map(|ei| (ei.call_site, ei.callee.name.as_slice() == "include"))
530+
ei.map(|ei| (ei.call_site, ei.callee.name == "include"))
531531
});
532532
match expn_info {
533533
None => break,

branches/auto/src/libsyntax/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a> Context<'a> {
132132
}
133133

134134
fn has_feature(&self, feature: &str) -> bool {
135-
self.features.iter().any(|n| n.as_slice() == feature)
135+
self.features.iter().any(|&n| n == feature)
136136
}
137137
}
138138

branches/auto/src/libsyntax/parse/lexer/comments.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,20 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
6666
let mut j = lines.len();
6767
// first line of all-stars should be omitted
6868
if lines.len() > 0 &&
69-
lines[0].as_slice().chars().all(|c| c == '*') {
69+
lines[0].chars().all(|c| c == '*') {
7070
i += 1;
7171
}
72-
while i < j && lines[i].as_slice().trim().is_empty() {
72+
while i < j && lines[i].trim().is_empty() {
7373
i += 1;
7474
}
7575
// like the first, a last line of all stars should be omitted
7676
if j > i && lines[j - 1]
77-
.as_slice()
7877
.chars()
7978
.skip(1)
8079
.all(|c| c == '*') {
8180
j -= 1;
8281
}
83-
while j > i && lines[j - 1].as_slice().trim().is_empty() {
82+
while j > i && lines[j - 1].trim().is_empty() {
8483
j -= 1;
8584
}
8685
return lines.slice(i, j).iter().map(|x| (*x).clone()).collect();
@@ -92,7 +91,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
9291
let mut can_trim = true;
9392
let mut first = true;
9493
for line in lines.iter() {
95-
for (j, c) in line.as_slice().chars().enumerate() {
94+
for (j, c) in line.chars().enumerate() {
9695
if j > i || !"* \t".contains_char(c) {
9796
can_trim = false;
9897
break;
@@ -117,7 +116,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
117116

118117
if can_trim {
119118
lines.iter().map(|line| {
120-
line.as_slice().slice(i + 1, line.len()).to_string()
119+
line.slice(i + 1, line.len()).to_string()
121120
}).collect()
122121
} else {
123122
lines
@@ -228,7 +227,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
228227
let s1 = match all_whitespace(s.as_slice(), col) {
229228
Some(col) => {
230229
if col < len {
231-
s.as_slice().slice(col, len).to_string()
230+
s.slice(col, len).to_string()
232231
} else {
233232
"".to_string()
234233
}
@@ -265,7 +264,7 @@ fn read_block_comment(rdr: &mut StringReader,
265264
if is_block_doc_comment(curr_line.as_slice()) {
266265
return
267266
}
268-
assert!(!curr_line.as_slice().contains_char('\n'));
267+
assert!(!curr_line.contains_char('\n'));
269268
lines.push(curr_line);
270269
} else {
271270
let mut level: int = 1;

branches/auto/src/libsyntax/parse/lexer/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl<'a> StringReader<'a> {
265265
/// Calls `f` with a string slice of the source text spanning from `start`
266266
/// up to but excluding `end`.
267267
fn with_str_from_to<T>(&self, start: BytePos, end: BytePos, f: |s: &str| -> T) -> T {
268-
f(self.filemap.src.as_slice().slice(
268+
f(self.filemap.src.slice(
269269
self.byte_offset(start).to_uint(),
270270
self.byte_offset(end).to_uint()))
271271
}
@@ -321,7 +321,6 @@ impl<'a> StringReader<'a> {
321321
let last_char = self.curr.unwrap();
322322
let next = self.filemap
323323
.src
324-
.as_slice()
325324
.char_range_at(current_byte_offset);
326325
let byte_offset_diff = next.next - current_byte_offset;
327326
self.pos = self.pos + Pos::from_uint(byte_offset_diff);
@@ -343,7 +342,7 @@ impl<'a> StringReader<'a> {
343342
pub fn nextch(&self) -> Option<char> {
344343
let offset = self.byte_offset(self.pos).to_uint();
345344
if offset < self.filemap.src.len() {
346-
Some(self.filemap.src.as_slice().char_at(offset))
345+
Some(self.filemap.src.char_at(offset))
347346
} else {
348347
None
349348
}

branches/auto/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2844,7 +2844,7 @@ impl<'a> State<'a> {
28442844
comments::BlankLine => {
28452845
// We need to do at least one, possibly two hardbreaks.
28462846
let is_semi = match self.s.last_token() {
2847-
pp::String(s, _) => ";" == s.as_slice(),
2847+
pp::String(s, _) => ";" == s,
28482848
_ => false
28492849
};
28502850
if is_semi || self.is_begin() || self.is_end() {

0 commit comments

Comments
 (0)