diff options
author | Igor Matuszewski <Xanewok@gmail.com> | 2020-03-14 15:46:20 +0100 |
---|---|---|
committer | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-03-18 17:52:40 +0100 |
commit | 926e1a7c0b6d1d20bdc3709c9c2147c98ba421cd (patch) | |
tree | e2d837c84491b24157f00c1b3855c8cc66589988 | |
parent | 4d68d98fbad657b75669993f1185f44a14f4d298 (diff) |
ipc: Tweak some Cookie methods
-rw-r--r-- | ipc/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ipc/src/lib.rs b/ipc/src/lib.rs index d96f47bf..eabb0680 100644 --- a/ipc/src/lib.rs +++ b/ipc/src/lib.rs @@ -184,7 +184,7 @@ impl Descriptor { self.connect(handle) } } else { - let cookie = Cookie::new()?; + let cookie = Cookie::new(); for external in [true, false].iter() { // Implement the IPC policy. if policy == core::IPCPolicy::Internal && *external { @@ -398,16 +398,16 @@ impl Cookie { const SIZE: usize = 32; /// Make a new cookie. - fn new() -> Result<Self> { + fn new() -> Self { let mut c = vec![0; Cookie::SIZE]; OsRng.fill_bytes(&mut c); - Ok(Cookie(c)) + Cookie(c) } /// Make a new cookie from a slice. - fn from(buf: &Vec<u8>) -> Option<Self> { + fn from(buf: &[u8]) -> Option<Self> { if buf.len() == Cookie::SIZE { - let mut c = Vec::<u8>::with_capacity(Cookie::SIZE); + let mut c = Vec::with_capacity(Cookie::SIZE); c.extend_from_slice(buf); Some(Cookie(c)) } else { |