From cfdee7b33e8ced500dd33821f103174ffd4d3e89 Mon Sep 17 00:00:00 2001 From: V Date: Wed, 16 Feb 2022 06:38:24 +0100 Subject: ripple/minitrace: use CString::from_vec_with_nul for construction New Rust version, fresh new APIs. Change-Id: I0983ea45a27ec25c16b1a7ff4dc828540ccd0b5f --- ripple/minitrace/src/main.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index ca0ce65..bc22563 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -89,12 +89,7 @@ impl Process { let mut buf = vec![]; mem.read_until(0, &mut buf)?; - // TODO(V): replace with CString::from_vec_with_nul when we update to Rust 1.58 - if buf.pop() != Some(0) { - bail!("Couldn't find null terminator"); - } - - Ok(CString::new(buf).expect("logic error")) + Ok(CString::from_vec_with_nul(buf).expect("logic error")) } } -- cgit 1.4.1