diff options
| author | Nixon Enraght-Moony <nixon.emoony@gmail.com> | 2021-02-21 19:45:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-21 19:45:32 +0000 |
| commit | a22d948eb0cd509b7ea52c3c615253d03ca9914b (patch) | |
| tree | f94d248950dd352158c5b96d371ab0455de84b1a | |
| parent | dd4b938c7f0c7704582a786f973bcfb17e523e94 (diff) | |
| download | rust-a22d948eb0cd509b7ea52c3c615253d03ca9914b.tar.gz rust-a22d948eb0cd509b7ea52c3c615253d03ca9914b.zip | |
Apply suggestions from code review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
| -rw-r--r-- | src/tools/jsondocck/src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/jsondocck/src/main.rs b/src/tools/jsondocck/src/main.rs index 8cb9564531a..9c9d49b821f 100644 --- a/src/tools/jsondocck/src/main.rs +++ b/src/tools/jsondocck/src/main.rs @@ -187,7 +187,7 @@ fn get_commands(template: &str) -> Result<Vec<Command>, ()> { /// Performs the actual work of ensuring a command passes. Generally assumes the command /// is syntactically valid. fn check_command(command: Command, cache: &mut Cache) -> Result<(), CkError> { - // FIXME: Be more granular about why, (eg syntax error, count not equal) + // FIXME: Be more granular about why, (e.g. syntax error, count not equal) let result = match command.kind { CommandKind::Has => { match command.args.len() { @@ -215,7 +215,7 @@ fn check_command(command: Command, cache: &mut Cache) -> Result<(), CkError> { v_holder = serde_json::from_str(&command.args[2]).unwrap(); &v_holder }; - !results.is_empty() && results.into_iter().any(|val| val == pat) + results.contains(pat) } Err(_) => false, } @@ -263,7 +263,7 @@ fn check_command(command: Command, cache: &mut Cache) -> Result<(), CkError> { Ok(results) => { assert_eq!(results.len(), 1); let r = cache.variables.insert(command.args[0].clone(), results[0].clone()); - assert!(r.is_none(), "Name collision"); + assert!(r.is_none(), "Name collision: {} is duplicated", command.args[0]); true } Err(_) => false, |
