From a9e029f74f58631471c3edfc237fe89fedc368d3 Mon Sep 17 00:00:00 2001 From: edef Date: Fri, 29 Jul 2022 16:08:28 +0000 Subject: ripple/minitrace: use inline variable style for format strings Change-Id: I6ed5bd5dffbf5706b718be4f15896b831b3d64f5 --- ripple/minitrace/src/main.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index 5ec1831..7ba6f96 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -73,7 +73,7 @@ impl Process { match waitpid(tgid.as_pid(), None).context("Couldn't waitpid on fresh child")? { WaitStatus::Stopped(_, Signal::SIGTRAP) => {} - status => bail!("unexpected child state: {:?}", status), + status => bail!("unexpected child state: {status:?}"), } Ok(Process { @@ -340,7 +340,7 @@ fn main() -> Result<()> { if !check_syscall(&process, entry) { ptrace::kill(event_tid.as_pid())?; - panic!("invalid syscall {:?}", entry); + panic!("invalid syscall {entry:?}"); } } (Some(EntryExit::Entry(entry)), WaitStatus::PtraceSyscall(event_tid)) => { @@ -358,10 +358,7 @@ fn main() -> Result<()> { // TODO(edef): this only works for main thread break; } - _ => panic!( - "unknown status {:?} with syscall_state = {:?}", - status, syscall_state - ), + _ => panic!("unknown status {status:?} with syscall_state = {syscall_state:?}"), } } @@ -398,7 +395,7 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { } SyscallEntry::access { filename, mode: _ } => { let filename = process.read_mem_cstr(filename as u64).unwrap(); - println!("access({:?}, ..)", filename); + println!("access({filename:?}, ..)"); } SyscallEntry::readlink { path, @@ -406,7 +403,7 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { bufsiz: _, } => { let path = process.read_mem_cstr(path as u64).unwrap(); - println!("readlink({:?}, ..)", path); + println!("readlink({path:?}, ..)"); } SyscallEntry::arch_prctl { option, arg2: _ } => { match option { @@ -430,7 +427,7 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { let filename = process.read_mem_cstr(filename as u64).unwrap(); - println!("openat(AT_FDCWD, {:?}, {:?}, ..)", filename, flags); + println!("openat(AT_FDCWD, {filename:?}, {flags:?}, ..)"); } SyscallEntry::newfstatat { dfd, @@ -449,7 +446,7 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { } SyscallEntry::set_robust_list { head: _, len } => { if len != 24 { - panic!("set_robust_list(2) len should be sizeof (struct robust_list_head), actually {}", len); + panic!("set_robust_list(2) len should be sizeof (struct robust_list_head), actually {len}"); } println!("set_robust_list(..)"); } @@ -473,7 +470,7 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { len, flags, } => { - println!("getrandom(.., {}, {:?})", len, flags); + println!("getrandom(.., {len}, {flags:?})"); } _ => {} } -- cgit 1.4.1