auto merge of #4969 : nickdesaulniers/rust/issue3869, r=brson
Issue #3869 review? @nikomatsakis Convert all uses of vec::slice to vec::view Issue #3869 Rename const_view to const_slice Renamed mut_view to mut_slice Fix windows build error. `buf` is borrowed by the call to `as_mut_buf()` and so we must invoke `slice()` outside of that call.
This commit is contained in:
commit
566bcf2225
21 changed files with 128 additions and 122 deletions
|
|
@ -24,7 +24,7 @@ macro_rules! bench (
|
|||
|
||||
fn main() {
|
||||
let argv = os::args();
|
||||
let tests = vec::view(argv, 1, argv.len());
|
||||
let tests = vec::slice(argv, 1, argv.len());
|
||||
|
||||
bench!(shift_push);
|
||||
bench!(read_line);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ fn find(mm: HashMap<~[u8], uint>, key: ~str) -> uint {
|
|||
|
||||
// given a map, increment the counter for a key
|
||||
fn update_freq(mm: HashMap<~[u8], uint>, key: &[u8]) {
|
||||
let key = vec::slice(key, 0, key.len());
|
||||
let key = vec::slice(key, 0, key.len()).to_vec();
|
||||
mm.update(key, 1, |v,v1| { v+v1 });
|
||||
}
|
||||
|
||||
|
|
@ -90,11 +90,11 @@ fn windows_with_carry(bb: &[u8], nn: uint,
|
|||
|
||||
let len = vec::len(bb);
|
||||
while ii < len - (nn - 1u) {
|
||||
it(vec::view(bb, ii, ii+nn));
|
||||
it(vec::slice(bb, ii, ii+nn));
|
||||
ii += 1u;
|
||||
}
|
||||
|
||||
return vec::slice(bb, len - (nn - 1u), len);
|
||||
return vec::slice(bb, len - (nn - 1u), len).to_vec();
|
||||
}
|
||||
|
||||
fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
fn vec_peek<T>(v: &r/[T]) -> &r/[T] {
|
||||
// This doesn't work, and should.
|
||||
// v.view(1, 5)
|
||||
vec::view(v, 1, 5)
|
||||
// v.slice(1, 5)
|
||||
vec::slice(v, 1, 5)
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue