From a3bbad467e6410b557d92aab7024d2dd974ae277 Mon Sep 17 00:00:00 2001 From: emma Date: Wed, 27 Nov 2024 12:28:32 -0700 Subject: [PATCH] getopt.rs(3): fixes formatting issues --- src/libgetopt.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libgetopt.rs b/src/libgetopt.rs index 8064c81..d1052f9 100644 --- a/src/libgetopt.rs +++ b/src/libgetopt.rs @@ -79,8 +79,8 @@ pub trait GetOpt { } impl GetOpt for Vec { - fn getopt(&self, optstring: &str) -> Option { - let c_strings: Vec<_> = self + fn getopt(&self, optstring: &str) -> Option { + let c_strings: Vec<_> = self .iter() .cloned() .map(|x| CString::new(x).unwrap().into_raw()) @@ -91,11 +91,11 @@ impl GetOpt for Vec { let argv = boxed as *const *mut c_char; /* operations are separated out so that everything lives long enough */ - let opts = CString::new(optstring).unwrap().into_raw(); - let len = self.len() as c_int; + let opts = CString::new(optstring).unwrap().into_raw(); + let len = self.len() as c_int; - unsafe { - let ret = match getopt(len, argv, opts) { + unsafe { + let ret = match getopt(len, argv, opts) { /* From getopt(3p): * * The getopt() function shall return the next option character @@ -141,8 +141,8 @@ impl GetOpt for Vec { * argv[optind] points to the string "--" * * getopt() shall return -1 after incrementing optind. */ - -1 => return None, - opt => { + -1 => return None, + opt => { let arg: Option; if optarg.is_null() { arg = None; } @@ -162,13 +162,13 @@ impl GetOpt for Vec { opt: Ok((opt as u8 as char).to_string()), }) }, - }; + }; /* delloc argv (something online said I should do this) */ let _ = Box::from_raw(boxed); return ret; - } - } + } + } } /* tests (good) */