mirror of
https://framagit.org/ppom/reaction
synced 2026-03-14 20:55:47 +01:00
run clippy on test target
This commit is contained in:
parent
b655ef1008
commit
f4b8572e94
8 changed files with 16 additions and 21 deletions
|
|
@ -183,7 +183,6 @@ impl Action {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ impl Filter {
|
|||
retry_period: retry_period.map(|s| s.into()),
|
||||
..Default::default()
|
||||
};
|
||||
filter.setup(&stream_name, &name, config_patterns).unwrap();
|
||||
filter.setup(stream_name, name, config_patterns).unwrap();
|
||||
filter
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +276,6 @@ impl Filter {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::concepts::action::tests::{ok_action, ok_action_with_after};
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ impl Pattern {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
process::Stdio,
|
||||
|
|
@ -278,11 +281,7 @@ impl FilterManager {
|
|||
.fetch_and_update(&m, |set| {
|
||||
let mut set = set.unwrap();
|
||||
set.remove(&t);
|
||||
if set.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(set)
|
||||
}
|
||||
(!set.is_empty()).then_some(set)
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
|
@ -346,7 +345,3 @@ impl FilterManager {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::unwrap_used)]
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use crate::{
|
|||
tests::TempDb,
|
||||
};
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn open_trees(
|
||||
db: &TempDb,
|
||||
filter: &Filter,
|
||||
|
|
@ -51,7 +52,7 @@ impl TestBed {
|
|||
}
|
||||
|
||||
fn part2(self, filter: &'static Filter, now: Time, db: Option<TempDb>) -> TestBed2 {
|
||||
let db = db.unwrap_or_else(|| TempDb::new());
|
||||
let db = db.unwrap_or_default();
|
||||
let controller = ShutdownController::new();
|
||||
let semaphore = Arc::new(Semaphore::new(1));
|
||||
TestBed2 {
|
||||
|
|
@ -62,7 +63,7 @@ impl TestBed {
|
|||
ordered_times: db.open_filter_ordered_times_tree(filter).unwrap(),
|
||||
triggers: db.open_filter_triggers_tree(filter).unwrap(),
|
||||
manager: FilterManager::new(
|
||||
&filter,
|
||||
filter,
|
||||
Some(semaphore.clone()),
|
||||
controller.token(),
|
||||
&db,
|
||||
|
|
@ -362,7 +363,7 @@ async fn one_db_match_one_runtime_match_one_action() {
|
|||
&bed.az_patterns,
|
||||
);
|
||||
|
||||
let db = TempDb::new();
|
||||
let db = TempDb::default();
|
||||
let (matches, ordered_times, _) = open_trees(&db, filter);
|
||||
|
||||
// Pre-add match
|
||||
|
|
@ -421,7 +422,7 @@ async fn one_outdated_db_match() {
|
|||
&bed.az_patterns,
|
||||
);
|
||||
|
||||
let db = TempDb::new();
|
||||
let db = TempDb::default();
|
||||
let (matches, ordered_times, _) = open_trees(&db, filter);
|
||||
|
||||
// Pre-add match
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ mod tests {
|
|||
#[test]
|
||||
fn tree_crud() {
|
||||
let filter = ok_filter();
|
||||
let db = TempDb::new();
|
||||
let db = TempDb::default();
|
||||
let triggers = db.open_filter_triggers_tree(&filter).unwrap();
|
||||
assert_eq!(BTreeMap::default(), triggers.as_map());
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
)]
|
||||
#![allow(clippy::upper_case_acronyms, clippy::mutable_key_type)]
|
||||
|
||||
// Allow unwrap in tests
|
||||
#![cfg_attr(test, allow(clippy::unwrap_used))]
|
||||
|
||||
pub mod cli;
|
||||
pub mod client;
|
||||
pub mod concepts;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(clippy::unwrap_used)]
|
||||
#![cfg(test)]
|
||||
|
||||
use std::{
|
||||
|
|
@ -61,8 +60,8 @@ pub struct TempDb {
|
|||
_tempdir: TempDir,
|
||||
}
|
||||
|
||||
impl TempDb {
|
||||
pub fn new() -> Self {
|
||||
impl Default for TempDb {
|
||||
fn default() -> Self {
|
||||
let _tempdir = TempDir::new().unwrap();
|
||||
let db = sled::open(_tempdir.path()).unwrap();
|
||||
TempDb { _tempdir, db }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue