about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-14 14:17:06 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-14 14:17:06 +0200
commit695c9586fe5a10b0d1d14ec3c4e5a5364b8ab3ea (patch)
treeec27bdbbd52e7c0f3bbe69106fc0b15c776f6664
parentb38b9e101a8bb60fb8c6b257b091c8d23d1b2017 (diff)
downloadrust-695c9586fe5a10b0d1d14ec3c4e5a5364b8ab3ea.tar.gz
rust-695c9586fe5a10b0d1d14ec3c4e5a5364b8ab3ea.zip
Remove the unnecessary local variable in set_logger.
-rw-r--r--src/liblog/lib.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index b3268c32f18..9cb835bd852 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<Logger + Send>) -> Option<Box<Logger + Send>> {
-    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