Skip to content

Commit 7692517

Browse files
committed
fix variable does not need to be mutable by shadowing
Signed-off-by: VGalaxies <[email protected]>
1 parent b9b1531 commit 7692517

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/profiler.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,16 @@ impl Profiler {
487487
let handler = signal::SigHandler::SigAction(perf_signal_handler);
488488
// SA_RESTART will only restart a syscall when it's safe to do so,
489489
// e.g. when it's a blocking read(2) or write(2). See man 7 signal.
490-
let mut flags = signal::SaFlags::SA_SIGINFO | signal::SaFlags::SA_RESTART;
490+
let flags = signal::SaFlags::SA_SIGINFO | signal::SaFlags::SA_RESTART;
491491
#[cfg(feature = "frame-pointer")]
492-
{
493-
if self.on_stack {
494-
// SA_ONSTACK will deliver the signal on an alternate stack. This is crucial
495-
// to prevent a stack overflow if the signal arrives at a thread with
496-
// a small stack, which is common when use pprof-rs in Go runtimes.
497-
flags |= signal::SaFlags::SA_ONSTACK;
498-
}
499-
}
492+
let flags = if self.on_stack {
493+
// SA_ONSTACK will deliver the signal on an alternate stack. This is crucial
494+
// to prevent a stack overflow if the signal arrives at a thread with
495+
// a small stack, which is common when use pprof-rs in Go runtimes.
496+
flags | signal::SaFlags::SA_ONSTACK
497+
} else {
498+
flags
499+
};
500500
let sigaction = signal::SigAction::new(handler, flags, signal::SigSet::empty());
501501
let old_action = unsafe { signal::sigaction(signal::SIGPROF, &sigaction) }?;
502502
self.old_sigaction = Some(old_action);

0 commit comments

Comments
 (0)