Skip to content

Commit

Permalink
Use {} instead of {:?} for debug!ing in util::range
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanzab committed May 7, 2014
1 parent 8c6eb08 commit ea68051
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/util/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::fmt;
use std::num;
use std::num::Bounded;

#[deriving(Show)]
pub enum RangeRelation<T> {
OverlapsBegin(/* overlap */ T),
OverlapsEnd(/* overlap */ T),
Expand Down Expand Up @@ -69,8 +70,8 @@ impl<T: Int + TotalOrd> Range<T> {
self.begin() < len && self.end() <= len && self.length() <= len
},
None => {
debug!("Range<T>::is_valid_for_string: string length ({}) is longer than the max \
value for T ({})", s_len, { let val: T = Bounded::max_value(); val });
debug!("Range<T>::is_valid_for_string: string length (len={}) is longer than the max \
value for T (max={})", s_len, { let val: T = Bounded::max_value(); val });
false
},
}
Expand Down Expand Up @@ -148,16 +149,16 @@ impl<T: Int + TotalOrd> Range<T> {
let overlap = other.end() - self.begin();
return OverlapsEnd(overlap);
}
fail!("relation_to_range(): didn't classify self={:?}, other={:?}",
fail!("relation_to_range(): didn't classify self={}, other={}",
self, other);
}

#[inline]
pub fn repair_after_coalesced_range(&mut self, other: &Range<T>) {
let relation = self.relation_to_range(other);
debug!("repair_after_coalesced_range: possibly repairing range {:?}", self);
debug!("repair_after_coalesced_range: relation of original range and coalesced range({:?}): {:?}",
other, relation);
debug!("repair_after_coalesced_range: possibly repairing range {}", *self);
debug!("repair_after_coalesced_range: relation of original range and coalesced range {}: {}",
*other, relation);
match relation {
EntirelyBefore => { },
EntirelyAfter => { self.shift_by(-other.length().to_int().unwrap()); },
Expand All @@ -169,6 +170,6 @@ impl<T: Int + TotalOrd> Range<T> {
self.reset(other.begin(), len);
}
};
debug!("repair_after_coalesced_range: new range: ---- {:?}", self);
debug!("repair_after_coalesced_range: new range: ---- {}", *self);
}
}

0 comments on commit ea68051

Please sign in to comment.