Style cleanup

This commit is contained in:
Steven Fackler
2013-12-05 23:09:03 -08:00
parent 1e22911249
commit 20904ab4e2
2 changed files with 16 additions and 16 deletions

View File

@@ -617,15 +617,15 @@ macro_rules! to_range_impl(
if self.is_empty() {
tag |= RANGE_EMPTY;
} else {
match self.lower() {
&None => tag |= RANGE_LOWER_UNBOUNDED,
&Some(RangeBound { type_: Inclusive, .. }) =>
match *self.lower() {
None => tag |= RANGE_LOWER_UNBOUNDED,
Some(RangeBound { type_: Inclusive, .. }) =>
tag |= RANGE_LOWER_INCLUSIVE,
_ => {}
}
match self.upper() {
&None => tag |= RANGE_UPPER_UNBOUNDED,
&Some(RangeBound { type_: Inclusive, .. }) =>
match *self.upper() {
None => tag |= RANGE_UPPER_UNBOUNDED,
Some(RangeBound { type_: Inclusive, .. }) =>
tag |= RANGE_UPPER_INCLUSIVE,
_ => {}
}
@@ -633,19 +633,19 @@ macro_rules! to_range_impl(
buf.write_i8(tag);
match self.lower() {
&Some(ref bound) => {
match *self.lower() {
Some(ref bound) => {
buf.write_be_i32(bound.value.raw_size() as i32);
bound.value.raw_to_sql(&mut buf);
}
&None => {}
None => {}
}
match self.upper() {
&Some(ref bound) => {
match *self.upper() {
Some(ref bound) => {
buf.write_be_i32(bound.value.raw_size() as i32);
bound.value.raw_to_sql(&mut buf);
}
&None => {}
None => {}
}
(Binary, Some(buf.inner()))

View File

@@ -156,8 +156,8 @@ impl<T: Ord+Normalizable> Range<T> {
/// If a bound is `None`, the range is unbounded in that direction.
pub fn new(lower: Option<RangeBound<LowerBound, T>>,
upper: Option<RangeBound<UpperBound, T>>) -> Range<T> {
let lower = lower.map(|bound| { Normalizable::normalize(bound) });
let upper = upper.map(|bound| { Normalizable::normalize(bound) });
let lower = lower.map(|bound| Normalizable::normalize(bound));
let upper = upper.map(|bound| Normalizable::normalize(bound));
match (&lower, &upper) {
(&Some(ref lower), &Some(ref upper)) => {
@@ -209,8 +209,8 @@ impl<T: Ord+Normalizable> Range<T> {
match *self {
Empty => false,
Normal(ref lower, ref upper) => {
lower.as_ref().map_default(true, |b| { b.in_bounds(value) }) &&
upper.as_ref().map_default(true, |b| { b.in_bounds(value) })
lower.as_ref().map_default(true, |b| b.in_bounds(value)) &&
upper.as_ref().map_default(true, |b| b.in_bounds(value))
}
}
}