calc_rational

CLI calculator for rational numbers.
git clone https://git.philomathiclife.com/repos/calc_rational
Log | Files | Refs | README

commit 9f2014bfe7dfa3b4d6d500e04c9ca5a52b0d6d21
parent 4db36eb57b6fe303a334d126e682c7f7bcb6e546
Author: Zack Newman <zack@philomathiclife.com>
Date:   Wed, 25 Oct 2023 12:37:43 -0600

new priv_sep

Diffstat:
MCargo.toml | 4++--
Msrc/lib.rs | 2+-
Msrc/main.rs | 6++++--
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" name = "calc_rational" readme = "README.md" repository = "https://git.philomathiclife.com/repos/calc_rational/" -version = "0.8.0" +version = "0.9.0" [lib] name = "calc_lib" @@ -24,7 +24,7 @@ num-bigint = { version = "0.4.4", default-features = false } num-integer = { version = "0.1.45", default-features = false } num-rational = { version = "0.4.1", default-features = false, features = ["num-bigint"] } num-traits = { version = "0.2.17", default-features = false } -priv_sep = { version = "0.7.0", default-features = false, features = ["openbsd"], optional = true } +priv_sep = { version = "0.8.0", default-features = false, features = ["openbsd"], optional = true } rand = { version = "0.8.5", default-features = false, features = ["std", "std_rng"], optional = true } [build-dependencies] diff --git a/src/lib.rs b/src/lib.rs @@ -820,7 +820,7 @@ impl<'input, 'cache, 'prev, 'scratch> Evaluator<'input, 'cache, 'prev, 'scratch> fn rand(rng: &mut ThreadRng) -> Result<i64, rand::Error> { let mut bytes = [0u8; 8]; rng.try_fill_bytes(&mut bytes) - .map(|_| i64::from_ne_bytes(bytes)) + .map(|()| i64::from_ne_bytes(bytes)) } /// Generates a random 64-bit integer inclusively between the passed arguments. #[inline] diff --git a/src/main.rs b/src/main.rs @@ -29,7 +29,7 @@ use calc_lib::lending_iterator::LendingIterator; use calc_lib::EvalIter; use core::fmt::{self, Display, Formatter}; #[cfg(all(feature = "priv_sep", target_os = "openbsd"))] -use priv_sep::{self, Promise}; +use priv_sep::{Promise, Promises}; use std::error; use std::io::{self, Error, Write}; /// Error returned by [`main`]. @@ -68,7 +68,9 @@ fn main() -> Result<(), Err> { #[cfg(all(feature = "priv_sep", target_os = "openbsd"))] #[inline] fn privsep() -> Result<(), Err> { - priv_sep::pledge(Some([Promise::Stdio].as_slice())).map_err(Err::Pledge) + Promises::new([Promise::Stdio]) + .pledge() + .map_err(Err::Pledge) } /// Returns Ok. #[allow(clippy::unnecessary_wraps)]