Skip to content

Commit 54f72f5

Browse files
committed
Switch tests to circle
1 parent f9d93c0 commit 54f72f5

File tree

4 files changed

+182
-106
lines changed

4 files changed

+182
-106
lines changed

‎.travis.yml‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎circle.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: ~/build
5+
docker:
6+
- image: jimmycuadra/rust:1.19.0
7+
- image: postgres:9.6
8+
environment:
9+
POSTGRES_PASSWORD: password
10+
steps:
11+
- checkout
12+
- restore_cache:
13+
key: registry
14+
- run: cargo generate-lockfile
15+
- save_cache:
16+
key: registry-{{epoch }}
17+
paths:
18+
- ~/.cargo/registry/index
19+
- restore_cache:
20+
key: dependencies-1.19-{{checksum "Cargo.lock"}}
21+
- run: cargo test
22+
- save_cache:
23+
key: dependencies-1.19-{{checksum "Cargo.lock"}}
24+
paths:
25+
- target
26+
- ~/.cargo/registry/cache

‎src/array.rs‎

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,28 @@ impl<T: fmt::Display> fmt::Display for Array<T>{
1616
fnfmt(&self,fmt:&mut fmt::Formatter) -> fmt::Result{
1717
ifself.dims.iter().any(|dim| dim.lower_bound != 1){
1818
for dim in&self.dims{
19-
try!(write!(fmt,
20-
"[{}:{}]",
21-
dim.lower_bound,
22-
dim.lower_bound + dim.len - 1));
19+
try!(write!(
20+
fmt,
21+
"[{}:{}]",
22+
dim.lower_bound,
23+
dim.lower_bound + dim.len - 1
24+
));
2325
}
2426
try!(write!(fmt,"="));
2527
}
2628
fmt_helper(0,&self.dims,&mutself.data.iter(), fmt)
2729
}
2830
}
2931

30-
fnfmt_helper<'a,T,I>(depth:usize,
31-
dims:&[Dimension],
32-
mutdata:&mutI,
33-
fmt:&mut fmt::Formatter)
34-
-> fmt::Result
35-
whereI:Iterator<Item = &'aT>,
36-
T:'a + fmt::Display
32+
fnfmt_helper<'a,T,I>(
33+
depth:usize,
34+
dims:&[Dimension],
35+
mutdata:&mutI,
36+
fmt:&mut fmt::Formatter,
37+
) -> fmt::Result
38+
where
39+
I:Iterator<Item = &'aT>,
40+
T:'a + fmt::Display,
3741
{
3842
if depth == dims.len(){
3943
returnwrite!(fmt,"{}", data.next().unwrap());
@@ -60,9 +64,11 @@ impl<T> Array<T>{
6064
/// Panics if the number of elements provided does not match the number of
6165
/// elements specified by the dimensions.
6266
pubfnfrom_parts(data:Vec<T>,dimensions:Vec<Dimension>) -> Array<T>{
63-
assert!((data.is_empty() && dimensions.is_empty()) ||
67+
assert!(
68+
(data.is_empty() && dimensions.is_empty()) ||
6469
data.len()asi32 == dimensions.iter().fold(1, |acc, i| acc * i.len),
65-
"size mismatch");
70+
"size mismatch"
71+
);
6672
Array{
6773
dims: dimensions,
6874
data: data,
@@ -72,10 +78,12 @@ impl<T> Array<T>{
7278
/// Creates a new one-dimensional array.
7379
pubfnfrom_vec(data:Vec<T>,lower_bound:i32) -> Array<T>{
7480
Array{
75-
dims:vec![Dimension{
76-
len: data.len()asi32,
77-
lower_bound: lower_bound,
78-
}],
81+
dims:vec![
82+
Dimension{
83+
len: data.len()asi32,
84+
lower_bound: lower_bound,
85+
},
86+
],
7987
data: data,
8088
}
8189
}
@@ -85,11 +93,13 @@ impl<T> Array<T>{
8593
/// For example, the one dimensional array `[1, 2]` would turn into the
8694
/// two-dimensional array `[[1, 2]]`.
8795
pubfnwrap(&mutself,lower_bound:i32){
88-
self.dims.insert(0,
89-
Dimension{
90-
len:1,
91-
lower_bound: lower_bound,
92-
});
96+
self.dims.insert(
97+
0,
98+
Dimension{
99+
len:1,
100+
lower_bound: lower_bound,
101+
},
102+
);
93103
}
94104

95105
/// Consumes another array, appending it to the top level dimension of this
@@ -106,8 +116,10 @@ impl<T> Array<T>{
106116
///
107117
/// Panics if the dimensions of the two arrays do not match.
108118
pubfnpush(&mutself,other:Array<T>){
109-
assert!(self.dims.len() - 1 == other.dims.len(),
110-
"cannot append differently shaped arrays");
119+
assert!(
120+
self.dims.len() - 1 == other.dims.len(),
121+
"cannot append differently shaped arrays"
122+
);
111123
for(dim1, dim2)inself.dims.iter().skip(1).zip(other.dims.iter()){
112124
assert!(dim1 == dim2,"cannot append differently shaped arrays");
113125
}
@@ -196,8 +208,27 @@ tuple_impl!(a: i32, b: i32, c: i32, d: i32);
196208
tuple_impl!(a:i32, b:i32, c:i32, d:i32, e:i32);
197209
tuple_impl!(a:i32, b:i32, c:i32, d:i32, e:i32, f:i32);
198210
tuple_impl!(a:i32, b:i32, c:i32, d:i32, e:i32, f:i32, g:i32);
199-
tuple_impl!(a:i32, b:i32, c:i32, d:i32, e:i32, f:i32, g:i32, h:i32);
200-
tuple_impl!(a:i32, b:i32, c:i32, d:i32, e:i32, f:i32, g:i32, h:i32, i:i32);
211+
tuple_impl!(
212+
a:i32,
213+
b:i32,
214+
c:i32,
215+
d:i32,
216+
e:i32,
217+
f:i32,
218+
g:i32,
219+
h:i32
220+
);
221+
tuple_impl!(
222+
a:i32,
223+
b:i32,
224+
c:i32,
225+
d:i32,
226+
e:i32,
227+
f:i32,
228+
g:i32,
229+
h:i32,
230+
i:i32
231+
);
201232

202233
/// Indexes into the `Array`, retrieving a reference to the contained
203234
/// value.

0 commit comments

Comments
(0)