Expect instead of a lousy unwrap with comment

This commit is contained in:
finga 2021-06-27 02:40:10 +02:00
parent 83e4ff36e5
commit 19130056ee

View file

@ -22,14 +22,14 @@ pub struct Create {
fn msgsize_default() -> usize { fn msgsize_default() -> usize {
match fs::read_to_string("/proc/sys/fs/mqueue/msgsize_default") { match fs::read_to_string("/proc/sys/fs/mqueue/msgsize_default") {
Ok(m) => m.trim().parse::<usize>().unwrap(), // should never fail Ok(m) => m.trim().parse::<usize>().expect("can never fail"),
_ => 8192, _ => 8192,
} }
} }
fn msg_default() -> usize { fn msg_default() -> usize {
match fs::read_to_string("/proc/sys/fs/mqueue/msg_default") { match fs::read_to_string("/proc/sys/fs/mqueue/msg_default") {
Ok(m) => m.trim().parse::<usize>().unwrap(), // should never fail Ok(m) => m.trim().parse::<usize>().expect("can never fail"),
_ => 10, _ => 10,
} }
} }