Skip to content

Commit 629e828

Browse files
committed
---
yaml --- r: 64263 b: refs/heads/snap-stage3 c: cc4baac h: refs/heads/master i: 64261: ad9ebad 64259: b38062a 64255: 1bdb44a v: v3
1 parent 4546fe9 commit 629e828

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 4f67ed535b4a89491bdfa6854104a23d8a98f5c4
4+
refs/heads/snap-stage3: cc4baac891b9de51d2bb78b7777ea33dd668cec7
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/etc/vim/ftplugin/rust.vim

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,4 @@ if exists("g:ftplugin_rust_source_path")
3333
let &l:path=g:ftplugin_rust_source_path . ',' . &l:path
3434
endif
3535

36-
if exists("g:loaded_delimitMate")
37-
if exists("b:delimitMate_excluded_regions")
38-
let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions
39-
endif
40-
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
41-
endif
42-
43-
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< | if exists('b:rust_original_delimitMate_excluded_regions') | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions | unlet b:rust_original_delimitMate_excluded_regions | elseif exists('b:delimitMate_excluded_regions') | unlet b:delimitMate_excluded_regions | endif"
36+
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<"

branches/snap-stage3/src/etc/vim/syntax/rust.vim

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>
113113
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>"
114114
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
115115

116-
" For the benefit of delimitMate
117-
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustLifetime
118-
syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate
119-
syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustLifetime
120-
121116
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
122117
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
123118
syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"

branches/snap-stage3/src/libextra/smallintmap.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818

1919
use std::cmp;
2020
use std::container::{Container, Mutable, Map, Set};
21-
use std::iterator::{Iterator,IteratorUtil,ZipIterator,Counter};
21+
use std::iterator::*;
2222
use std::uint;
2323
use std::util::replace;
2424
use std::vec::{VecIterator,VecMutIterator,VecRevIterator,VecMutRevIterator};
25+
use std::vec::VecConsumeIterator;
2526

2627
#[allow(missing_doc)]
2728
pub struct SmallIntMap<T> {
@@ -204,6 +205,17 @@ impl<V> SmallIntMap<V> {
204205
iter: Counter::new(self.len() as int - 1, -1).zip(self.v.mut_rev_iter())
205206
}
206207
}
208+
209+
/// Empties the hash map, moving all values into the specified closure
210+
pub fn consume(&mut self)
211+
-> FilterMapIterator<(uint, Option<V>), (uint, V),
212+
EnumerateIterator<Option<V>, VecConsumeIterator<Option<V>>>>
213+
{
214+
let values = replace(&mut self.v, ~[]);
215+
values.consume_iter().enumerate().filter_map(|(i, v)| {
216+
v.map_consume(|v| (i, v))
217+
})
218+
}
207219
}
208220

209221
impl<V:Copy> SmallIntMap<V> {
@@ -625,6 +637,21 @@ mod tests {
625637

626638
assert!(a.iter().all(|(_,v)| *v == 5 ));
627639
}
640+
641+
#[test]
642+
fn test_consume() {
643+
let mut m = SmallIntMap::new();
644+
m.insert(1, ~2);
645+
let mut called = false;
646+
for m.consume().advance |(k, v)| {
647+
assert!(!called);
648+
called = true;
649+
assert_eq!(k, 1);
650+
assert_eq!(v, ~2);
651+
}
652+
assert!(called);
653+
m.insert(2, ~1);
654+
}
628655
}
629656

630657
#[cfg(test)]

0 commit comments

Comments
 (0)