Skip to content

Commit 03ab585

Browse files
committed
Fix README examples
1 parent 826f10b commit 03ab585

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
4040
#[cfg(test)]
4141
mod tests {
4242
use quickcheck::quickcheck;
43+
use super::reverse;
4344

44-
quickcheck! {
45-
fn prop(xs: Vec<u32>) -> bool {
46-
xs == reverse(&reverse(&xs))
47-
}
45+
quickcheck! {
46+
fn prop(xs: Vec<u32>) -> bool {
47+
xs == reverse(&reverse(&xs))
48+
}
4849
}
4950
}
5051
```
@@ -61,17 +62,18 @@ To use the `#[quickcheck]` attribute, you must import the `quickcheck` macro
6162
from the `quickcheck_macros` crate:
6263

6364
```rust
65+
fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
66+
let mut rev = vec![];
67+
for x in xs {
68+
rev.insert(0, x.clone())
69+
}
70+
rev
71+
}
72+
6473
#[cfg(test)]
6574
mod tests {
6675
use quickcheck_macros::quickcheck;
67-
68-
fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
69-
let mut rev = vec![];
70-
for x in xs {
71-
rev.insert(0, x.clone())
72-
}
73-
rev
74-
}
76+
use super::reverse;
7577

7678
#[quickcheck]
7779
fn double_reversal_is_identity(xs: Vec<isize>) -> bool {

0 commit comments

Comments
 (0)