Skip to content

Commit

Permalink
Revert MSRV-breaking clippy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 27, 2022
1 parent 7a25b7f commit 7ea3450
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/data/arithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ impl Number {
.checked_add(rhs.to_i1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)),
(Layout::Integer(IntLayout { bytes, .. }), false) => self
.to_u1024_bytes()
.checked_add(rhs.to_u1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)),
(Layout::Float(_), _) => panic!("integer addition of float numbers"),
}
}
Expand All @@ -150,13 +150,13 @@ impl Number {
.checked_sub(rhs.to_i1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)),
(Layout::Integer(IntLayout { bytes, .. }), false) => self
.to_u1024_bytes()
.checked_sub(rhs.to_u1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)),
(Layout::Float(_), _) => panic!("integer subtraction of float numbers"),
}
}
Expand All @@ -178,13 +178,13 @@ impl Number {
.checked_mul(rhs.to_i1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::signed(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::signed(bytes)) || flags.wrap).then(|| n)),
(Layout::Integer(IntLayout { bytes, .. }), false) => self
.to_u1024_bytes()
.checked_mul(rhs.to_u1024_bytes())
.map(Number::from)
.and_then(|n| n.reshaped(Layout::unsigned(n.layout().bytes()), true))
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then_some(n)),
.and_then(|mut n| (n.reshape(Layout::unsigned(bytes)) || flags.wrap).then(|| n)),
(Layout::Float(_), _) => panic!("integer multiplication of float numbers"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ impl Number {
/// Transformed number as an optional - or `None` if the operation was impossible without
/// discarding bit information and `wrap` is set to false.
pub fn reshaped(mut self, to: Layout, wrap: bool) -> Option<Number> {
self.reshape(to).then_some(self).or(if wrap { Some(self) } else { None })
self.reshape(to).then(|| self).or(if wrap { Some(self) } else { None })
}

#[doc(hidden)]
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
//!
//! [AluVM]: https://github.com/internet2-org/aluvm-spec
// TODO: Remove this once MSRV >= 1.62
#![allow(clippy::unnecessary_lazy_evaluations)]

// TODO(#6) Complete string operations
// TODO(#7) Complete assembly compiler for string operations
// TODO(#8) Implement operations on Edwards curves
Expand Down

0 comments on commit 7ea3450

Please sign in to comment.