summaryrefslogtreecommitdiff
path: root/rust/kernel/str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/str.rs')
-rw-r--r--rust/kernel/str.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
index 9b5228025e2c..52a500742c1a 100644
--- a/rust/kernel/str.rs
+++ b/rust/kernel/str.rs
@@ -576,25 +576,9 @@ macro_rules! c_str {
mod tests {
use super::*;
- struct String(CString);
-
- impl String {
- fn from_fmt(args: fmt::Arguments<'_>) -> Self {
- String(CString::try_from_fmt(args).unwrap())
- }
- }
-
- impl Deref for String {
- type Target = str;
-
- fn deref(&self) -> &str {
- self.0.to_str().unwrap()
- }
- }
-
macro_rules! format {
($($f:tt)*) => ({
- &*String::from_fmt(::kernel::fmt!($($f)*))
+ CString::try_from_fmt(::kernel::fmt!($($f)*)).unwrap().to_str().unwrap()
})
}