1
Fork 0

Remove the unnecessary local variable in set_logger.

This commit is contained in:
Ms2ger 2015-10-14 14:17:06 +02:00
parent b38b9e101a
commit 695c9586fe

View file

@ -328,8 +328,7 @@ pub fn log_level() -> u32 {
/// Replaces the thread-local logger with the specified logger, returning the old /// Replaces the thread-local logger with the specified logger, returning the old
/// logger. /// logger.
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> { pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
let mut l = Some(logger); LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), Some(logger)))
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), l.take()))
} }
/// A LogRecord is created by the logging macros, and passed as the only /// A LogRecord is created by the logging macros, and passed as the only