about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/liblog/directive.rs4
-rw-r--r--src/liblog/lib.rs3
2 files changed, 3 insertions, 4 deletions
diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs
index 12a5c131170..3958969cfca 100644
--- a/src/liblog/directive.rs
+++ b/src/liblog/directive.rs
@@ -46,7 +46,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
                  spec);
         return (dirs, None);
     }
-    mods.map(|m| {
+    if let Some(m) = mods {
         for s in m.split(',') {
             if s.is_empty() {
                 continue
@@ -83,7 +83,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
                 level: log_level,
             });
         }
-    });
+    }
 
     (dirs, filter.map(str::to_owned))
 }
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