diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index b3268c32f18f7..9cb835bd8525d 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -328,8 +328,7 @@ pub fn log_level() -> u32 { /// Replaces the thread-local logger with the specified logger, returning the old /// logger. pub fn set_logger(logger: Box) -> Option> { - let mut l = Some(logger); - LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), l.take())) + LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), Some(logger))) } /// A LogRecord is created by the logging macros, and passed as the only