Skip to content

Fix for upstream changes #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation = "https://sfackler.github.io/rust-postgres-array/doc/postgres_arr

[dependencies]
postgres = "0.7.1"
byteorder = "0.2.11"
byteorder = "0.3"

[dev-dependencies]
rustc-serialize = "0.3"
Expand Down
6 changes: 3 additions & 3 deletions src/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl<T> FromSql for ArrayBase<Option<T>> where T: FromSql {
let _element_type: Oid = try!(raw.read_u32::<BigEndian>());

let mut dim_info = Vec::with_capacity(ndim);
for _ in range(0, ndim) {
for _ in (0..ndim) {
dim_info.push(DimensionInfo {
len: try!(raw.read_u32::<BigEndian>()) as usize,
lower_bound: try!(raw.read_i32::<BigEndian>()) as isize,
Expand All @@ -28,11 +28,11 @@ impl<T> FromSql for ArrayBase<Option<T>> where T: FromSql {
let nele = if dim_info.len() == 0 {
0
} else {
dim_info.iter().map(|info| info.len as usize).product()
dim_info.iter().map(|info| info.len).product()
};

let mut elements = Vec::with_capacity(nele);
for _ in range(0, nele) {
for _ in (0..nele) {
let len = try!(raw.read_i32::<BigEndian>());
if len < 0 {
elements.push(None);
Expand Down
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Multi-dimensional arrays with per-dimension specifiable lower bounds
#![doc(html_root_url="https://sfackler.github.io/rust-postgres-array/doc")]
#![feature(core, io)]
#![feature(core)]

#[macro_use(to_sql_checked)]
extern crate postgres;
Expand Down Expand Up @@ -362,23 +362,23 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_get_2d_fail() {
let mut a = ArrayBase::from_vec(vec!(0i32, 1, 2), -1);
a.wrap(1);
a.get(1);
}

#[test]
#[should_fail]
#[should_panic]
fn test_2d_slice_range_fail_low() {
let mut a = ArrayBase::from_vec(vec!(0i32, 1, 2), -1);
a.wrap(1);
a.slice(0);
}

#[test]
#[should_fail]
#[should_panic]
fn test_2d_slice_range_fail_high() {
let mut a = ArrayBase::from_vec(vec!(0i32, 1, 2), -1);
a.wrap(1);
Expand All @@ -396,22 +396,22 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_push_move_wrong_lower_bound() {
let mut a = ArrayBase::from_vec(vec!(1i32), -1);
a.push_move(ArrayBase::from_vec(vec!(2), 0));
}

#[test]
#[should_fail]
#[should_panic]
fn test_push_move_wrong_dims() {
let mut a = ArrayBase::from_vec(vec!(1i32), -1);
a.wrap(1);
a.push_move(ArrayBase::from_vec(vec!(1, 2), -1));
}

#[test]
#[should_fail]
#[should_panic]
fn test_push_move_wrong_dim_count() {
let mut a = ArrayBase::from_vec(vec!(1i32), -1);
a.wrap(1);
Expand Down Expand Up @@ -472,14 +472,14 @@ mod tests {
}

#[test]
#[should_fail]
#[should_panic]
fn test_base_overslice() {
let a = ArrayBase::from_vec(vec!(1i32), 0);
a.slice(0);
}

#[test]
#[should_fail]
#[should_panic]
fn test_slice_overslice() {
let mut a = ArrayBase::from_vec(vec!(1i32), 0);
a.wrap(0);
Expand Down