aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev_tools/src/bin/docs-code-box-fix.rs3
-rw-r--r--mingling_core/src/tester/chain_process_tester.rs22
-rw-r--r--mingling_macros/src/chain.rs2
3 files changed, 13 insertions, 14 deletions
diff --git a/dev_tools/src/bin/docs-code-box-fix.rs b/dev_tools/src/bin/docs-code-box-fix.rs
index 0212259..dab3638 100644
--- a/dev_tools/src/bin/docs-code-box-fix.rs
+++ b/dev_tools/src/bin/docs-code-box-fix.rs
@@ -82,8 +82,7 @@ fn fix_code_box_empty_lines(content: &str) -> String {
ensure_space_before_code_block(&mut result);
// output code content
- for j in code_start..code_end {
- let code_line = lines[j];
+ for code_line in lines.iter().take(code_end).skip(code_start) {
if code_line.is_empty() {
result.push(' ');
} else {
diff --git a/mingling_core/src/tester/chain_process_tester.rs b/mingling_core/src/tester/chain_process_tester.rs
index aefe00a..8cba772 100644
--- a/mingling_core/src/tester/chain_process_tester.rs
+++ b/mingling_core/src/tester/chain_process_tester.rs
@@ -32,18 +32,18 @@ where
{
match result {
ChainProcess::Ok(any) => {
- if let Some(member_id) = member_id {
- if member_id != any.0.member_id {
- panic!(
- "Unexpected result type: expected {}, found {}",
- member_id, any.0.member_id
- );
- }
+ if let Some(member_id) = member_id
+ && member_id != any.0.member_id
+ {
+ panic!(
+ "Unexpected result type: expected {}, found {}",
+ member_id, any.0.member_id
+ );
}
- if let Some(next) = next {
- if next != any.1 {
- panic!("Unexpected next state: expected {}, found {}", next, any.1);
- }
+ if let Some(next) = next
+ && next != any.1
+ {
+ panic!("Unexpected next state: expected {}, found {}", next, any.1);
}
}
ChainProcess::Err(chain_process_error) => {
diff --git a/mingling_macros/src/chain.rs b/mingling_macros/src/chain.rs
index e7b2db2..6646a68 100644
--- a/mingling_macros/src/chain.rs
+++ b/mingling_macros/src/chain.rs
@@ -77,7 +77,7 @@ pub fn chain_attr(attr: TokenStream, item: TokenStream) -> TokenStream {
match &**ty {
Type::Path(type_path) => {
let last_segment = type_path.path.segments.last().unwrap();
- if last_segment.ident.to_string() != "NextProcess" {
+ if last_segment.ident != "NextProcess" {
return syn::Error::new(
ty.span(),
"Chain function must return `NextProcess`",