diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-05-26 16:12:13 -0400 | 
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-05-26 16:12:13 -0400 | 
| commit | 85502b2214d50ba0ddf2a5fb454e4d28a160d175 (patch) | |
| tree | 0fdee4062c437b2f36ea8a62457d753a56bf60de /rust/kernel/str.rs | |
| parent | 2bb0e398852fa3f3ac9e1a6a6f756c09fe4997f6 (diff) | |
| parent | a867688c8cbb1b83667a6665362d89e8c762e820 (diff) | |
Merge tag 'loongarch-kvm-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson into HEAD
LoongArch KVM changes for v6.16
1. Don't flush tlb if HW PTW supported.
2. Add LoongArch KVM selftests support.
Diffstat (limited to 'rust/kernel/str.rs')
| -rw-r--r-- | rust/kernel/str.rs | 46 | 
1 files changed, 23 insertions, 23 deletions
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 878111cb77bc..fb61ce81ea28 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -73,7 +73,7 @@ impl fmt::Display for BStr {                  b'\r' => f.write_str("\\r")?,                  // Printable characters.                  0x20..=0x7e => f.write_char(b as char)?, -                _ => write!(f, "\\x{:02x}", b)?, +                _ => write!(f, "\\x{b:02x}")?,              }          }          Ok(()) @@ -109,7 +109,7 @@ impl fmt::Debug for BStr {                  b'\\' => f.write_str("\\\\")?,                  // Printable characters.                  0x20..=0x7e => f.write_char(b as char)?, -                _ => write!(f, "\\x{:02x}", b)?, +                _ => write!(f, "\\x{b:02x}")?,              }          }          f.write_char('"') @@ -447,7 +447,7 @@ impl fmt::Display for CStr {                  // Printable character.                  f.write_char(c as char)?;              } else { -                write!(f, "\\x{:02x}", c)?; +                write!(f, "\\x{c:02x}")?;              }          }          Ok(()) @@ -479,7 +479,7 @@ impl fmt::Debug for CStr {                  // Printable characters.                  b'\"' => f.write_str("\\\"")?,                  0x20..=0x7e => f.write_char(c as char)?, -                _ => write!(f, "\\x{:02x}", c)?, +                _ => write!(f, "\\x{c:02x}")?,              }          }          f.write_str("\"") @@ -641,13 +641,13 @@ mod tests {      #[test]      fn test_cstr_display() {          let hello_world = CStr::from_bytes_with_nul(b"hello, world!\0").unwrap(); -        assert_eq!(format!("{}", hello_world), "hello, world!"); +        assert_eq!(format!("{hello_world}"), "hello, world!");          let non_printables = CStr::from_bytes_with_nul(b"\x01\x09\x0a\0").unwrap(); -        assert_eq!(format!("{}", non_printables), "\\x01\\x09\\x0a"); +        assert_eq!(format!("{non_printables}"), "\\x01\\x09\\x0a");          let non_ascii = CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").unwrap(); -        assert_eq!(format!("{}", non_ascii), "d\\xe9j\\xe0 vu"); +        assert_eq!(format!("{non_ascii}"), "d\\xe9j\\xe0 vu");          let good_bytes = CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0").unwrap(); -        assert_eq!(format!("{}", good_bytes), "\\xf0\\x9f\\xa6\\x80"); +        assert_eq!(format!("{good_bytes}"), "\\xf0\\x9f\\xa6\\x80");      }      #[test] @@ -658,47 +658,47 @@ mod tests {              bytes[i as usize] = i.wrapping_add(1);          }          let cstr = CStr::from_bytes_with_nul(&bytes).unwrap(); -        assert_eq!(format!("{}", cstr), ALL_ASCII_CHARS); +        assert_eq!(format!("{cstr}"), ALL_ASCII_CHARS);      }      #[test]      fn test_cstr_debug() {          let hello_world = CStr::from_bytes_with_nul(b"hello, world!\0").unwrap(); -        assert_eq!(format!("{:?}", hello_world), "\"hello, world!\""); +        assert_eq!(format!("{hello_world:?}"), "\"hello, world!\"");          let non_printables = CStr::from_bytes_with_nul(b"\x01\x09\x0a\0").unwrap(); -        assert_eq!(format!("{:?}", non_printables), "\"\\x01\\x09\\x0a\""); +        assert_eq!(format!("{non_printables:?}"), "\"\\x01\\x09\\x0a\"");          let non_ascii = CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").unwrap(); -        assert_eq!(format!("{:?}", non_ascii), "\"d\\xe9j\\xe0 vu\""); +        assert_eq!(format!("{non_ascii:?}"), "\"d\\xe9j\\xe0 vu\"");          let good_bytes = CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0").unwrap(); -        assert_eq!(format!("{:?}", good_bytes), "\"\\xf0\\x9f\\xa6\\x80\""); +        assert_eq!(format!("{good_bytes:?}"), "\"\\xf0\\x9f\\xa6\\x80\"");      }      #[test]      fn test_bstr_display() {          let hello_world = BStr::from_bytes(b"hello, world!"); -        assert_eq!(format!("{}", hello_world), "hello, world!"); +        assert_eq!(format!("{hello_world}"), "hello, world!");          let escapes = BStr::from_bytes(b"_\t_\n_\r_\\_\'_\"_"); -        assert_eq!(format!("{}", escapes), "_\\t_\\n_\\r_\\_'_\"_"); +        assert_eq!(format!("{escapes}"), "_\\t_\\n_\\r_\\_'_\"_");          let others = BStr::from_bytes(b"\x01"); -        assert_eq!(format!("{}", others), "\\x01"); +        assert_eq!(format!("{others}"), "\\x01");          let non_ascii = BStr::from_bytes(b"d\xe9j\xe0 vu"); -        assert_eq!(format!("{}", non_ascii), "d\\xe9j\\xe0 vu"); +        assert_eq!(format!("{non_ascii}"), "d\\xe9j\\xe0 vu");          let good_bytes = BStr::from_bytes(b"\xf0\x9f\xa6\x80"); -        assert_eq!(format!("{}", good_bytes), "\\xf0\\x9f\\xa6\\x80"); +        assert_eq!(format!("{good_bytes}"), "\\xf0\\x9f\\xa6\\x80");      }      #[test]      fn test_bstr_debug() {          let hello_world = BStr::from_bytes(b"hello, world!"); -        assert_eq!(format!("{:?}", hello_world), "\"hello, world!\""); +        assert_eq!(format!("{hello_world:?}"), "\"hello, world!\"");          let escapes = BStr::from_bytes(b"_\t_\n_\r_\\_\'_\"_"); -        assert_eq!(format!("{:?}", escapes), "\"_\\t_\\n_\\r_\\\\_'_\\\"_\""); +        assert_eq!(format!("{escapes:?}"), "\"_\\t_\\n_\\r_\\\\_'_\\\"_\"");          let others = BStr::from_bytes(b"\x01"); -        assert_eq!(format!("{:?}", others), "\"\\x01\""); +        assert_eq!(format!("{others:?}"), "\"\\x01\"");          let non_ascii = BStr::from_bytes(b"d\xe9j\xe0 vu"); -        assert_eq!(format!("{:?}", non_ascii), "\"d\\xe9j\\xe0 vu\""); +        assert_eq!(format!("{non_ascii:?}"), "\"d\\xe9j\\xe0 vu\"");          let good_bytes = BStr::from_bytes(b"\xf0\x9f\xa6\x80"); -        assert_eq!(format!("{:?}", good_bytes), "\"\\xf0\\x9f\\xa6\\x80\""); +        assert_eq!(format!("{good_bytes:?}"), "\"\\xf0\\x9f\\xa6\\x80\"");      }  }  | 
