]> git.lizzy.rs Git - rust.git/commitdiff
Improve diff display in case the whole key in missing
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 1 Feb 2021 10:27:17 +0000 (11:27 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Mon, 1 Feb 2021 14:56:51 +0000 (15:56 +0100)
src/tools/rustdoc-js/tester.js

index 3f6bd6039752604e8d8513638457c709037a7817..c21277de3351387937bb8775a54ff3efe50228e9 100644 (file)
@@ -203,6 +203,10 @@ function betterLookingDiff(entry, data) {
         if (!entry.hasOwnProperty(key)) {
             continue;
         }
+        if (!data || !data.hasOwnProperty(key)) {
+            output += '-' + spaces + contentToDiffLine(key, entry[key]) + '\n';
+            continue;
+        }
         let value = data[key];
         if (value !== entry[key]) {
             output += '-' + spaces + contentToDiffLine(key, entry[key]) + '\n';