Skip to content

Commit

Permalink
Replace assert! with an error
Browse files Browse the repository at this point in the history
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
  • Loading branch information
NobodyXu committed Jun 29, 2022
1 parent c691145 commit 0345ff6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ pub struct Acquired {

impl Client {
pub fn new(mut limit: usize) -> io::Result<Client> {
assert!(limit <= 4096, "Can't have limit larger than 4096 since the pipe would block forever when writing to it");
if limit > 4096 {
return Err(io::Error::new(io::ErrorKind::Other, "Can't have limit larger than 4096 since the pipe would block forever when writing to it"));
}

let client = unsafe { Client::mk()? };

Expand Down

0 comments on commit 0345ff6

Please sign in to comment.