Skip to content

Commit 695c958

Browse files
committed
Remove the unnecessary local variable in set_logger.
1 parent b38b9e1 commit 695c958

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/liblog/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ pub fn log_level() -> u32 {
328328
/// Replaces the thread-local logger with the specified logger, returning the old
329329
/// logger.
330330
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
331-
let mut l = Some(logger);
332-
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), l.take()))
331+
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), Some(logger)))
333332
}
334333

335334
/// A LogRecord is created by the logging macros, and passed as the only

0 commit comments

Comments
 (0)