about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNixon Enraght-Moony <nixon.emoony@gmail.com>2021-02-21 19:45:32 +0000
committerGitHub <noreply@github.com>2021-02-21 19:45:32 +0000
commita22d948eb0cd509b7ea52c3c615253d03ca9914b (patch)
treef94d248950dd352158c5b96d371ab0455de84b1a
parentdd4b938c7f0c7704582a786f973bcfb17e523e94 (diff)
downloadrust-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.rs6
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,