Skip to content

Commit d4c2e36

Browse files
ericktbrson
authored andcommitted
---
yaml --- r: 32570 b: refs/heads/dist-snap c: 35a418e h: refs/heads/master v: v3
1 parent f6c3c50 commit d4c2e36

File tree

2 files changed

+43
-47
lines changed

2 files changed

+43
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 34bf0b9e979e528f14e1265a36488d0707e71805
10+
refs/heads/dist-snap: 35a418eb88fbb9f8868d87dca5e5858ddf5f9b9f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/send_map.rs

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ mod linear {
130130
k: &K) -> SearchResult {
131131
let _ = for self.bucket_sequence(hash) |i| {
132132
match buckets[i] {
133-
Some(bkt) => if bkt.hash == hash && *k == bkt.key {
134-
return FoundEntry(i);
135-
},
136-
None => return FoundHole(i)
133+
Some(bkt) => if bkt.hash == hash && *k == bkt.key {
134+
return FoundEntry(i);
135+
},
136+
None => return FoundHole(i)
137137
}
138138
};
139139
return TableFull;
@@ -158,12 +158,12 @@ mod linear {
158158

159159
fn insert_opt_bucket(&mut self, +bucket: Option<Bucket<K,V>>) {
160160
match move bucket {
161-
Some(Bucket {hash: move hash,
162-
key: move key,
163-
value: move value}) => {
164-
self.insert_internal(hash, move key, move value);
165-
}
166-
None => {}
161+
Some(Bucket {hash: move hash,
162+
key: move key,
163+
value: move value}) => {
164+
self.insert_internal(hash, move key, move value);
165+
}
166+
None => {}
167167
}
168168
}
169169

@@ -172,24 +172,24 @@ mod linear {
172172
/// True if there was no previous entry with that key
173173
fn insert_internal(&mut self, hash: uint, +k: K, +v: V) -> bool {
174174
match self.bucket_for_key_with_hash(self.buckets, hash, &k) {
175-
TableFull => {fail ~"Internal logic error";}
176-
FoundHole(idx) => {
177-
debug!("insert fresh (%?->%?) at idx %?, hash %?",
178-
k, v, idx, hash);
179-
self.buckets[idx] = Some(Bucket {hash: hash,
180-
key: k,
181-
value: v});
182-
self.size += 1;
183-
return true;
184-
}
185-
FoundEntry(idx) => {
186-
debug!("insert overwrite (%?->%?) at idx %?, hash %?",
187-
k, v, idx, hash);
188-
self.buckets[idx] = Some(Bucket {hash: hash,
189-
key: k,
190-
value: v});
191-
return false;
192-
}
175+
TableFull => { fail ~"Internal logic error"; }
176+
FoundHole(idx) => {
177+
debug!("insert fresh (%?->%?) at idx %?, hash %?",
178+
k, v, idx, hash);
179+
self.buckets[idx] = Some(Bucket {hash: hash,
180+
key: k,
181+
value: v});
182+
self.size += 1;
183+
true
184+
}
185+
FoundEntry(idx) => {
186+
debug!("insert overwrite (%?->%?) at idx %?, hash %?",
187+
k, v, idx, hash);
188+
self.buckets[idx] = Some(Bucket {hash: hash,
189+
key: k,
190+
value: v});
191+
false
192+
}
193193
}
194194
}
195195

@@ -233,12 +233,8 @@ mod linear {
233233
// http://www.maths.lse.ac.uk/Courses/MA407/del-hash.pdf
234234

235235
let mut idx = match self.bucket_for_key(self.buckets, k) {
236-
TableFull | FoundHole(_) => {
237-
return false;
238-
}
239-
FoundEntry(idx) => {
240-
idx
241-
}
236+
TableFull | FoundHole(_) => return false,
237+
FoundEntry(idx) => idx
242238
};
243239

244240
let len_buckets = self.buckets.len();
@@ -272,8 +268,8 @@ mod linear {
272268
fn contains_key(&const self,
273269
k: &K) -> bool {
274270
match self.bucket_for_key(self.buckets, k) {
275-
FoundEntry(_) => {true}
276-
TableFull | FoundHole(_) => {false}
271+
FoundEntry(_) => {true}
272+
TableFull | FoundHole(_) => {false}
277273
}
278274
}
279275

@@ -318,17 +314,17 @@ mod linear {
318314
impl<K:Hash IterBytes Eq, V: Copy> LinearMap<K,V> {
319315
fn find(&const self, k: &K) -> Option<V> {
320316
match self.bucket_for_key(self.buckets, k) {
321-
FoundEntry(idx) => {
322-
// FIXME (#3148): Once we rewrite found_entry, this
323-
// failure case won't be necessary
324-
match self.buckets[idx] {
325-
Some(bkt) => {Some(copy bkt.value)}
326-
None => fail ~"LinearMap::find: internal logic error"
317+
FoundEntry(idx) => {
318+
// FIXME (#3148): Once we rewrite found_entry, this
319+
// failure case won't be necessary
320+
match self.buckets[idx] {
321+
Some(bkt) => {Some(copy bkt.value)}
322+
None => fail ~"LinearMap::find: internal logic error"
323+
}
324+
}
325+
TableFull | FoundHole(_) => {
326+
None
327327
}
328-
}
329-
TableFull | FoundHole(_) => {
330-
None
331-
}
332328
}
333329
}
334330

0 commit comments

Comments
 (0)