Skip to content

Commit e8c3a5f

Browse files
author
Sven
authored
refactor: fix clippy warnings (#165)
1 parent 1037481 commit e8c3a5f

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/filter/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn parse_spec(spec: &str) -> (Vec<Directive>, Option<inner::Filter>) {
312312
}
313313
mods.map(|m| {
314314
for s in m.split(',') {
315-
if s.len() == 0 {
315+
if s.is_empty() {
316316
continue;
317317
}
318318
let mut parts = s.split('=');
@@ -354,15 +354,15 @@ fn parse_spec(spec: &str) -> (Vec<Directive>, Option<inner::Filter>) {
354354
}
355355
});
356356

357-
let filter = filter.map_or(None, |filter| match inner::Filter::new(filter) {
357+
let filter = filter.and_then(|filter| match inner::Filter::new(filter) {
358358
Ok(re) => Some(re),
359359
Err(e) => {
360360
eprintln!("warning: invalid regex filter - {}", e);
361361
None
362362
}
363363
});
364364

365-
return (dirs, filter);
365+
(dirs, filter)
366366
}
367367

368368
// Check whether a level and target are enabled by the set of directives.

src/fmt/writer/atty.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ from being printed.
99

1010
#[cfg(feature = "atty")]
1111
mod imp {
12-
use atty;
13-
1412
pub(in crate::fmt) fn is_stdout() -> bool {
1513
atty::is(atty::Stream::Stdout)
1614
}

src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
246246
#![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))]
247247
#![deny(missing_debug_implementations, missing_docs, warnings)]
248+
#![allow(clippy::needless_doctest_main)]
248249

249250
use std::{borrow::Cow, cell::RefCell, env, io};
250251

@@ -260,10 +261,10 @@ use self::fmt::writer::{self, Writer};
260261
use self::fmt::Formatter;
261262

262263
/// The default name for the environment variable to read filters from.
263-
pub const DEFAULT_FILTER_ENV: &'static str = "RUST_LOG";
264+
pub const DEFAULT_FILTER_ENV: &str = "RUST_LOG";
264265

265266
/// The default name for the environment variable to read style preferences from.
266-
pub const DEFAULT_WRITE_STYLE_ENV: &'static str = "RUST_LOG_STYLE";
267+
pub const DEFAULT_WRITE_STYLE_ENV: &str = "RUST_LOG_STYLE";
267268

268269
/// Set of environment variables to configure from.
269270
///

0 commit comments

Comments
 (0)