Skip to content

Commit c768b73

Browse files
committed
(rustfmt)
1 parent fdd751a commit c768b73

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

hdf5-rs/src/hl/container.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'a> Reader<'a> {
5757

5858
/// Reads a slice of an n-dimensional array.
5959
/// If the dimensionality `D` has a fixed number of dimensions, it must match the dimensionality of
60-
/// the slice, after singleton dimensions are dropped.
60+
/// the slice, after singleton dimensions are dropped.
6161
/// Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
6262
/// a multidimensional slice.
6363
pub fn read_slice<T, S, D>(&self, slice: &SliceInfo<S, D>) -> Result<Array<T, D>>
@@ -86,7 +86,12 @@ impl<'a> Reader<'a> {
8686
// Check that return dimensionality is 0.
8787
if let Some(ndim) = D::NDIM {
8888
let obj_ndim = 0;
89-
ensure!(obj_ndim == ndim, "ndim mismatch: slice outputs dims {}, output type dims {}", obj_ndim, ndim);
89+
ensure!(
90+
obj_ndim == ndim,
91+
"ndim mismatch: slice outputs dims {}, output type dims {}",
92+
obj_ndim,
93+
ndim
94+
);
9095
}
9196

9297
// Fall back to a simple read for the scalar case
@@ -111,7 +116,12 @@ impl<'a> Reader<'a> {
111116
// axes are dropped.
112117
if let Some(ndim) = D::NDIM {
113118
let obj_ndim = reduced_shape.len();
114-
ensure!(obj_ndim == ndim, "ndim mismatch: slice outputs dims {}, output type dims {}", obj_ndim, ndim);
119+
ensure!(
120+
obj_ndim == ndim,
121+
"ndim mismatch: slice outputs dims {}, output type dims {}",
122+
obj_ndim,
123+
ndim
124+
);
115125
}
116126

117127
let mspace = Dataspace::try_new(&out_shape, false)?;
@@ -177,7 +187,6 @@ impl<'a> Reader<'a> {
177187
self.read()
178188
}
179189

180-
181190
/// Reads the given `slice` of the dataset into a 2-dimensional array.
182191
/// The slice must yield a 2-dimensional result.
183192
pub fn read_slice_2d<T, S>(&self, slice: &SliceInfo<S, ndarray::Ix2>) -> Result<Array2<T>>
@@ -530,7 +539,7 @@ impl Container {
530539

531540
/// Reads a slice of an n-dimensional array.
532541
/// If the dimensionality `D` has a fixed number of dimensions, it must match the dimensionality of
533-
/// the slice, after singleton dimensions are dropped.
542+
/// the slice, after singleton dimensions are dropped.
534543
/// Use the multi-dimensional slice macro `s![]` from `ndarray` to conveniently create
535544
/// a multidimensional slice.
536545
pub fn read_slice<T, S, D>(&self, slice: &SliceInfo<S, D>) -> Result<Array<T, D>>

hdf5-rs/src/hl/space.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ impl Dataspace {
5757
/// Returns the shape of array that is capable of holding the resulting slice.
5858
/// Useful when you want to read a subset of a dataset.
5959
pub fn select_slice<S>(&self, slice: S) -> Result<Vec<Ix>>
60-
where S: AsRef<[SliceOrIndex]>
60+
where
61+
S: AsRef<[SliceOrIndex]>,
6162
{
6263
let shape = self.dims();
6364
let ss: &[SliceOrIndex] = slice.as_ref();

hdf5-rs/tests/test_dataset.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ where
8888

8989
let v: Array1<T> = dsr.read_slice_1d(s![.., 0])?;
9090
assert_eq!(shape[0], v.shape()[0]);
91-
}
91+
}
9292

9393
if ndim == 3 && shape[0] > 0 && shape[1] > 0 && shape[2] > 0 {
9494
let v: Array2<T> = dsr.read_slice_2d(s![0, .., ..])?;
@@ -97,7 +97,7 @@ where
9797

9898
let v: Array1<T> = dsr.read_slice_1d(s![0, 0, ..])?;
9999
assert_eq!(shape[2], v.shape()[0]);
100-
}
100+
}
101101

102102
Ok(())
103103
}

0 commit comments

Comments
 (0)