File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
crates/kernel_cmdline/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,11 @@ impl<'a> Cmdline<'a> {
156156
157157 // The exact parameter was not found, so we append it.
158158 let self_mut = self . 0 . to_mut ( ) ;
159- if !self_mut. is_empty ( ) && !self_mut. last ( ) . unwrap ( ) . is_ascii_whitespace ( ) {
159+ if self_mut
160+ . last ( )
161+ . filter ( |v| !v. is_ascii_whitespace ( ) )
162+ . is_some ( )
163+ {
160164 self_mut. push ( b' ' ) ;
161165 }
162166 self_mut. extend_from_slice ( param. parameter ) ;
@@ -203,7 +207,11 @@ impl<'a> Cmdline<'a> {
203207 if !seen_key {
204208 // The parameter was not found, so we append it.
205209 let self_mut = self . 0 . to_mut ( ) ;
206- if !self_mut. is_empty ( ) && !self_mut. last ( ) . unwrap ( ) . is_ascii_whitespace ( ) {
210+ if self_mut
211+ . last ( )
212+ . filter ( |v| !v. is_ascii_whitespace ( ) )
213+ . is_some ( )
214+ {
207215 self_mut. push ( b' ' ) ;
208216 }
209217 self_mut. extend_from_slice ( param. parameter ) ;
You can’t perform that action at this time.
0 commit comments