Calling a function in unwrap_or causes that function to always
be called even when not needed. Instead use unwrap_or_else with
a closure which will only be called when needed.
.zip(expected_uuid)
.map(|(x, y)| x.cmp(y))
.find(|&ord| ord != cmp::Ordering::Equal)
- .unwrap_or(bind_uuid.len().cmp(&expected_uuid.len()))
+ .unwrap_or_else(|| bind_uuid.len().cmp(&expected_uuid.len()))
);
}
}
>> (SmbRequestCreateAndXRecord {
disposition: disposition,
create_options: create_options,
- file_name: file_name.unwrap_or(Vec::new()),
+ file_name: file_name.unwrap_or_default(),
}))
}