Skip to content

Commit

Permalink
fix: remove some allow directive
Browse files Browse the repository at this point in the history
Signed-off-by: Dat Tien Nguyen <[email protected]>
  • Loading branch information
datbeohbbh committed Oct 20, 2024
1 parent baeae3a commit ffe7c9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
6 changes: 2 additions & 4 deletions datadriven/src/datadriven.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ where

// run_directive runs just one directive in the input.
//
#[allow(clippy::manual_inspect)]
fn run_directive<F>(r: &mut TestDataReader, mut f: F)
where
F: FnMut(&TestData) -> String,
Expand All @@ -157,10 +156,9 @@ where
if has_blank_line(&actual) {
r.emit("----");

r.rewrite_buffer.as_mut().map(|rb| {
if let Some(rb) = r.rewrite_buffer.as_mut() {
rb.push_str(&actual);
rb
});
}

r.emit("----");
r.emit("----");
Expand Down
6 changes: 2 additions & 4 deletions datadriven/src/test_data_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,10 @@ impl<'a> TestDataReader<'a> {
}
}

#[allow(clippy::manual_inspect)]
pub fn emit(&mut self, str: &str) {
self.rewrite_buffer.as_mut().map(|rb| {
if let Some(rb) = self.rewrite_buffer.as_mut() {
let str = str.to_string() + "\n";
rb.push_str(&str);
rb
});
}
}
}
33 changes: 14 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,9 @@ node.propose_conf_change(vec![], cc).unwrap();
This process is a two-phase process, during the midst of it the peer group's leader is managing
**two independent, possibly overlapping peer sets**.
\> **Note:** In order to maintain resiliency guarantees (progress while a majority of both peer sets is
active), it is recommended to wait until the entire peer group has exited the transition phase
before taking old, removed peers offline.
> **Note:** In order to maintain resiliency guarantees (progress while a majority of both peer sets is
> active), it is recommended to wait until the entire peer group has exited the transition phase
> before taking old, removed peers offline.
*/

Expand Down Expand Up @@ -569,25 +569,20 @@ pub mod prelude {

/// The default logger we fall back to when passed `None` in external facing constructors.
///
/// Currently, this is a `log` adaptor behind a `Once` to ensure there is no clobbering.
/// Currently, this is a `log` adaptor behind a `OnceLock` to ensure there is no clobbering.
#[cfg(any(test, feature = "default-logger"))]
#[allow(static_mut_refs)]
pub fn default_logger() -> slog::Logger {
use slog::{o, Drain};
use std::sync::{Mutex, Once};

static LOGGER_INITIALIZED: Once = Once::new();
static mut LOGGER: Option<slog::Logger> = None;

let logger = unsafe {
LOGGER_INITIALIZED.call_once(|| {
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build();
let drain = slog_envlogger::new(drain);
LOGGER = Some(slog::Logger::root(Mutex::new(drain).fuse(), o!()));
});
LOGGER.as_ref().unwrap()
};
use std::sync::{Mutex, OnceLock};

static LOGGER_INITIALIZED: OnceLock<slog::Logger> = OnceLock::new();
let logger = LOGGER_INITIALIZED.get_or_init(|| {
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build();
let drain = slog_envlogger::new(drain);
slog::Logger::root(Mutex::new(drain).fuse(), o!())
});

if let Some(case) = std::thread::current()
.name()
.and_then(|v| v.split(':').last())
Expand Down

0 comments on commit ffe7c9a

Please sign in to comment.