Skip to content

Commit d20fe12

Browse files
committed
Auto merge of #29044 - Ms2ger:cleanup-log, r=alexcrichton
2 parents 56a1419 + 695c958 commit d20fe12

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/liblog/directive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
4646
spec);
4747
return (dirs, None);
4848
}
49-
mods.map(|m| {
49+
if let Some(m) = mods {
5050
for s in m.split(',') {
5151
if s.is_empty() {
5252
continue
@@ -83,7 +83,7 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
8383
level: log_level,
8484
});
8585
}
86-
});
86+
}
8787

8888
(dirs, filter.map(str::to_owned))
8989
}

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)