File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ impl IrUser {
357357
358358// Internal helper for rounding up a value to a multiple of another value.
359359fn round_up ( value : usize , multiple : usize ) -> usize {
360- if value % multiple != 0 {
360+ if ! value. is_multiple_of ( multiple) {
361361 ( value / multiple) * multiple + multiple
362362 } else {
363363 ( value / multiple) * multiple
Original file line number Diff line number Diff line change @@ -466,11 +466,12 @@ impl Uds {
466466 /// ```
467467 #[ doc( alias = "udsInit" ) ]
468468 pub fn new ( username : Option < & str > ) -> Result < Self , Error > {
469- if let Some ( n) = username {
470- if n. len ( ) > 10 {
471- return Err ( Error :: UsernameTooLong ) ;
472- }
469+ if let Some ( n) = username
470+ && n. len ( ) > 10
471+ {
472+ return Err ( Error :: UsernameTooLong ) ;
473473 }
474+
474475 let cstr = username. map ( CString :: new) . transpose ( ) ?;
475476 let handler = ServiceReference :: new (
476477 & UDS_ACTIVE ,
@@ -535,7 +536,7 @@ impl Uds {
535536 additional_id. unwrap_or ( 0 ) ,
536537 whitelist_macaddr
537538 . map ( |m| m. as_bytes ( ) . as_ptr ( ) )
538- . unwrap_or ( null ( ) ) ,
539+ . unwrap_or_default ( ) ,
539540 self . service_status ( ) == ServiceStatus :: Client ,
540541 )
541542 } ) ?;
You can’t perform that action at this time.
0 commit comments