Skip to content

Commit 7799efa

Browse files
committed
reverted example sort-axis from_indices
1 parent 0914ea9 commit 7799efa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/sort-axis.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ pub struct Permutation
2020
impl Permutation
2121
{
2222
/// Checks if the permutation is correct
23-
pub fn from_indices(v: Vec<usize>) -> Option<Self>
23+
pub fn from_indices(v: Vec<usize>) -> Result<Self, ()>
2424
{
2525
let perm = Permutation { indices: v };
26-
perm.correct().then_some(perm)
26+
if perm.correct() {
27+
Ok(perm)
28+
} else {
29+
Err(())
30+
}
2731
}
2832

2933
fn correct(&self) -> bool

0 commit comments

Comments
 (0)