diff --git a/src/compile.rs b/src/compile.rs index e38be64..99bbf65 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -829,9 +829,9 @@ fn handle_derive<'a>( // If the explicitly listed parents define the function, use only ones that are listed. If they // don't, get it from all of the types parents let this_func_parents = if selected_parents.iter().any(|p| { - types.get(p.as_ref()).map_or(false, |parent_type| { - parent_type.defines_function(f.as_ref(), functions) - }) + types + .get(p.as_ref()) + .is_some_and(|parent_type| parent_type.defines_function(f.as_ref(), functions)) }) { &selected_parents } else { diff --git a/src/functions.rs b/src/functions.rs index 2b73a5d..bfd8a66 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -3621,7 +3621,7 @@ fn validate_argument_error_handler( // If this is the associated call we need to do some more digging to give the user a better // error message. // Unwraps of func_info are safe in this block because of the false return on map_or - if func_info.map_or(false, |f| f.is_associated_call) { + if func_info.is_some_and(|f| f.is_associated_call) { let mut error = ErrorItem::make_compile_or_internal_error( &format!( "Expected type inheriting {} for associated call", diff --git a/src/internal_rep.rs b/src/internal_rep.rs index c537c3f..e84e50b 100644 --- a/src/internal_rep.rs +++ b/src/internal_rep.rs @@ -687,10 +687,7 @@ impl TypeInfo { // This is the sexp for *declaring* the type impl From<&TypeInfo> for Option { fn from(typeinfo: &TypeInfo) -> Option { - let flavor = match typeinfo.get_cil_declaration_type() { - Some(f) => f, - None => return None, - }; + let flavor = typeinfo.get_cil_declaration_type()?; Some(list(&[ atom_s(flavor), atom_s(typeinfo.name.get_cil_name().as_ref()),