rename hashmap find_ref/get_ref -> find/get
This commit is contained in:
parent
203fcbd0f3
commit
ee0a8c68ab
3 changed files with 10 additions and 10 deletions
|
@ -369,7 +369,7 @@ pub mod linear {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pure fn find_ref(&self, k: &K) -> Option<&self/V> {
|
pure fn find(&self, k: &K) -> Option<&self/V> {
|
||||||
match self.bucket_for_key(self.buckets, k) {
|
match self.bucket_for_key(self.buckets, k) {
|
||||||
FoundEntry(idx) => {
|
FoundEntry(idx) => {
|
||||||
match self.buckets[idx] {
|
match self.buckets[idx] {
|
||||||
|
@ -389,8 +389,8 @@ pub mod linear {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pure fn get_ref(&self, k: &K) -> &self/V {
|
pure fn get(&self, k: &K) -> &self/V {
|
||||||
match self.find_ref(k) {
|
match self.find(k) {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => fail fmt!("No entry found for key: %?", k),
|
None => fail fmt!("No entry found for key: %?", k),
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ pub mod linear {
|
||||||
if self.len() != other.len() { return false; }
|
if self.len() != other.len() { return false; }
|
||||||
|
|
||||||
for self.each |key, value| {
|
for self.each |key, value| {
|
||||||
match other.find_ref(key) {
|
match other.find(key) {
|
||||||
None => return false,
|
None => return false,
|
||||||
Some(v) => if value != v { return false },
|
Some(v) => if value != v { return false },
|
||||||
}
|
}
|
||||||
|
@ -593,11 +593,11 @@ pub mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn find_ref() {
|
pub fn find() {
|
||||||
let mut m = ~LinearMap();
|
let mut m = ~LinearMap();
|
||||||
assert m.find_ref(&1).is_none();
|
assert m.find(&1).is_none();
|
||||||
m.insert(1, 2);
|
m.insert(1, 2);
|
||||||
match m.find_ref(&1) {
|
match m.find(&1) {
|
||||||
None => fail,
|
None => fail,
|
||||||
Some(v) => assert *v == 2
|
Some(v) => assert *v == 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -911,7 +911,7 @@ pub impl Decoder: serialize::Decoder {
|
||||||
// FIXME(#3148) This hint should not be necessary.
|
// FIXME(#3148) This hint should not be necessary.
|
||||||
let obj: &self/~Object = obj;
|
let obj: &self/~Object = obj;
|
||||||
|
|
||||||
match obj.find_ref(&name.to_owned()) {
|
match obj.find(&name.to_owned()) {
|
||||||
None => fail fmt!("no such field: %s", name),
|
None => fail fmt!("no such field: %s", name),
|
||||||
Some(json) => {
|
Some(json) => {
|
||||||
self.stack.push(json);
|
self.stack.push(json);
|
||||||
|
@ -969,7 +969,7 @@ impl Json : Eq {
|
||||||
if d0.len() == d1.len() {
|
if d0.len() == d1.len() {
|
||||||
let mut equal = true;
|
let mut equal = true;
|
||||||
for d0.each |k, v0| {
|
for d0.each |k, v0| {
|
||||||
match d1.find_ref(k) {
|
match d1.find(k) {
|
||||||
Some(v1) if v0 == v1 => { },
|
Some(v1) if v0 == v1 => { },
|
||||||
_ => { equal = false; break }
|
_ => { equal = false; break }
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ impl @Mut<Prep> : TPrep {
|
||||||
name: &str, val: &str) -> bool {
|
name: &str, val: &str) -> bool {
|
||||||
do self.borrow_imm |p| {
|
do self.borrow_imm |p| {
|
||||||
let k = kind.to_owned();
|
let k = kind.to_owned();
|
||||||
let f = (*p.ctxt.freshness.get_ref(&k))(name, val);
|
let f = (*p.ctxt.freshness.get(&k))(name, val);
|
||||||
do p.ctxt.logger.borrow_imm |lg| {
|
do p.ctxt.logger.borrow_imm |lg| {
|
||||||
if f {
|
if f {
|
||||||
lg.info(fmt!("%s %s:%s is fresh",
|
lg.info(fmt!("%s %s:%s is fresh",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue