File tree Expand file tree Collapse file tree 6 files changed +18
-29
lines changed
cpu_config/x86_64/cpuid/intel Expand file tree Collapse file tree 6 files changed +18
-29
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ enum RebaseSnapError {
4444}
4545
4646fn build_arg_parser < ' a > ( ) -> ArgParser < ' a > {
47- let arg_parser = ArgParser :: new ( )
47+ ArgParser :: new ( )
4848 . arg (
4949 Argument :: new ( BASE_FILE )
5050 . required ( true )
@@ -56,9 +56,7 @@ fn build_arg_parser<'a>() -> ArgParser<'a> {
5656 . required ( true )
5757 . takes_value ( true )
5858 . help ( "File path of the diff mem snapshot." ) ,
59- ) ;
60-
61- arg_parser
59+ )
6260}
6361
6462fn get_files ( args : & Arguments ) -> Result < ( File , File ) , FileError > {
Original file line number Diff line number Diff line change @@ -345,7 +345,7 @@ fn default_brand_string(
345345 let c = before[ i] ;
346346 match c {
347347 b' ' => break ' outer Ok ( before. split_at ( i) ) ,
348- b'0' ..=b'9' | b'.' => continue ,
348+ b'0' ..=b'9' | b'.' => ( ) ,
349349 _ => break ,
350350 }
351351 }
@@ -373,13 +373,12 @@ fn default_brand_string(
373373 // Include frequency suffix e.g. "GHz"
374374 . chain ( after. iter ( ) . copied ( ) )
375375 // Pad with 0s to `BRAND_STRING_LENGTH`
376- . chain (
377- std:: iter:: repeat ( b'\0' ) . take (
378- BRAND_STRING_LENGTH
379- . checked_sub ( len)
380- . ok_or ( DefaultBrandStringError :: Overflow ) ?,
381- ) ,
382- )
376+ . chain ( std:: iter:: repeat_n (
377+ b'\0' ,
378+ BRAND_STRING_LENGTH
379+ . checked_sub ( len)
380+ . ok_or ( DefaultBrandStringError :: Overflow ) ?,
381+ ) )
383382 . collect :: < Vec < _ > > ( ) ;
384383 debug_assert_eq ! ( brand_string. len( ) , BRAND_STRING_LENGTH ) ;
385384
Original file line number Diff line number Diff line change @@ -142,9 +142,9 @@ impl WriteVolatile for TxBuf {
142142 & mut self ,
143143 buf : & VolatileSlice < B > ,
144144 ) -> Result < usize , VolatileMemoryError > {
145- self . push ( buf) . map ( | ( ) | buf . len ( ) ) . map_err ( |err| {
146- VolatileMemoryError :: IOError ( std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , err ) )
147- } )
145+ self . push ( buf)
146+ . map ( | ( ) | buf . len ( ) )
147+ . map_err ( |err| VolatileMemoryError :: IOError ( std :: io :: Error :: other ( err ) ) )
148148 }
149149}
150150
Original file line number Diff line number Diff line change @@ -234,16 +234,16 @@ impl<'de> Deserialize<'de> for LevelFilter {
234234 {
235235 use serde:: de:: Error ;
236236 let key = String :: deserialize ( deserializer) ?;
237- let level = match key. to_lowercase ( ) . as_str ( ) {
237+
238+ match key. to_lowercase ( ) . as_str ( ) {
238239 "off" => Ok ( LevelFilter :: Off ) ,
239240 "trace" => Ok ( LevelFilter :: Trace ) ,
240241 "debug" => Ok ( LevelFilter :: Debug ) ,
241242 "info" => Ok ( LevelFilter :: Info ) ,
242243 "warn" | "warning" => Ok ( LevelFilter :: Warn ) ,
243244 "error" => Ok ( LevelFilter :: Error ) ,
244245 _ => Err ( D :: Error :: custom ( "Invalid LevelFilter" ) ) ,
245- } ;
246- level
246+ }
247247 }
248248}
249249
Original file line number Diff line number Diff line change @@ -106,15 +106,7 @@ pub(crate) mod tests {
106106 ] ;
107107
108108 let combined_caps = Kvm :: combine_capabilities ( & additional_capabilities) ;
109- assert ! (
110- combined_caps
111- . iter( )
112- . any( |c| * c == kvm_bindings:: KVM_CAP_IOMMU )
113- ) ;
114- assert ! (
115- !combined_caps
116- . iter( )
117- . any( |c| * c == kvm_bindings:: KVM_CAP_IOEVENTFD )
118- ) ;
109+ assert ! ( combined_caps. contains( & kvm_bindings:: KVM_CAP_IOMMU ) ) ;
110+ assert ! ( !combined_caps. contains( & kvm_bindings:: KVM_CAP_IOEVENTFD ) ) ;
119111 }
120112}
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ impl Vcpu {
140140 // _before_ running this, then there is nothing we can do.
141141 Self :: TLS_VCPU_PTR . with ( |cell : & VcpuCell | {
142142 if let Some ( vcpu_ptr) = cell. get ( ) {
143- if vcpu_ptr == self as * mut Vcpu {
143+ if std :: ptr :: eq ( vcpu_ptr, self ) {
144144 Self :: TLS_VCPU_PTR . with ( |cell : & VcpuCell | cell. take ( ) ) ;
145145 return Ok ( ( ) ) ;
146146 }
You can’t perform that action at this time.
0 commit comments