refactor(context): reimplement context as an kv store #195
Annotations
7 warnings
associated function `new` is never used:
mfm_core/src/states/mod.rs#L19
warning: associated function `new` is never used
--> mfm_core/src/states/mod.rs:19:8
|
18 | impl ReadConfig {
| --------------- associated function in this implementation
19 | fn new() -> Self {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused `std::result::Result` that must be used:
mfm_machine/src/state_machine/mod.rs#L183
warning: unused `std::result::Result` that must be used
--> mfm_machine/src/state_machine/mod.rs:183:9
|
183 | / self.tracker.as_mut().track(
184 | | Index::new(next_state_index, state.label(), state.tags()),
185 | | context.clone(),
186 | | );
| |_________^
|
= note: this `Result` may be an `Err` variant, which should be handled
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
183 | let _ = self.tracker.as_mut().track(
| +++++++
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
mfm_machine/src/state_machine/mod.rs#L104
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> mfm_machine/src/state_machine/mod.rs:104:9
|
104 | / match self.reached_max_recoveries() {
105 | | (true, steps) => {
106 | | return Err(StateMachineError::ReachedMaxRecoveries(
107 | | (),
... |
111 | | (_, _) => (),
112 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
104 ~ if let (true, steps) = self.reached_max_recoveries() {
105 + return Err(StateMachineError::ReachedMaxRecoveries(
106 + (),
107 + anyhow!("reached max recoveries ({})", steps),
108 + ))
109 + }
|
|
struct `TrackerHistory` has a public `len` method, but no `is_empty` method:
mfm_machine/src/state_machine/tracker.rs#L38
warning: struct `TrackerHistory` has a public `len` method, but no `is_empty` method
--> mfm_machine/src/state_machine/tracker.rs:38:5
|
38 | pub fn len(&self) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty
= note: `#[warn(clippy::len_without_is_empty)]` on by default
|
you should consider adding a `Default` implementation for `TrackerHistory`:
mfm_machine/src/state_machine/tracker.rs#L34
warning: you should consider adding a `Default` implementation for `TrackerHistory`
--> mfm_machine/src/state_machine/tracker.rs:34:5
|
34 | / pub fn new() -> Self {
35 | | TrackerHistory(Vec::new())
36 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
= note: `#[warn(clippy::new_without_default)]` on by default
help: try adding this
|
33 + impl Default for TrackerHistory {
34 + fn default() -> Self {
35 + Self::new()
36 + }
37 + }
|
|
`.map().collect()` can be replaced with `.try_for_each()`:
mfm_machine/src/state_machine/tracker.rs#L20
warning: `.map().collect()` can be replaced with `.try_for_each()`
--> mfm_machine/src/state_machine/tracker.rs:20:9
|
20 | / self.0
21 | | .iter()
22 | | .map(|(history_id, index, value)| {
23 | | writeln!(
... |
28 | | })
29 | | .collect()
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_collect_result_unit
= note: `#[warn(clippy::map_collect_result_unit)]` on by default
help: try
|
20 ~ self.0
21 + .iter().try_for_each(|(history_id, index, value)| {
22 + writeln!(
23 + f,
24 + "history_id ({}); index ({:?}); context ({:?})",
25 + history_id, index, value
26 + )
27 + })
|
|
build
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|