summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec/tests
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-10-05 15:37:55 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-10-05 19:28:19 +0300
commit021fcbd90cebe83bb2f0298f2e7001605b5a97d7 (patch)
tree93ed7d94cf867c841b65dbd60841efa73966883a /compiler/rustc_target/src/spec/tests
parentf317a93d4d326442680eaeb78c22eece739433c7 (diff)
downloadrust-021fcbd90cebe83bb2f0298f2e7001605b5a97d7.tar.gz
rust-021fcbd90cebe83bb2f0298f2e7001605b5a97d7.zip
rustc_target: Refactor away `TargetResult`
Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.
Diffstat (limited to 'compiler/rustc_target/src/spec/tests')
-rw-r--r--compiler/rustc_target/src/spec/tests/tests_impl.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/compiler/rustc_target/src/spec/tests/tests_impl.rs b/compiler/rustc_target/src/spec/tests/tests_impl.rs
index b2c2b8254d8..d06ab368e1c 100644
--- a/compiler/rustc_target/src/spec/tests/tests_impl.rs
+++ b/compiler/rustc_target/src/spec/tests/tests_impl.rs
@@ -1,16 +1,9 @@
 use super::super::*;
 
-pub(super) fn test_target(target: TargetResult) {
-    // Grab the TargetResult struct. If we successfully retrieved
-    // a Target, then the test JSON encoding/decoding can run for this
-    // Target on this testing platform (i.e., checking the iOS targets
-    // only on a Mac test platform).
-    if let Ok(original) = target {
-        original.check_consistency();
-        let as_json = original.to_json();
-        let parsed = Target::from_json(as_json).unwrap();
-        assert_eq!(original, parsed);
-    }
+// Test target self-consistency and JSON encoding/decoding roundtrip.
+pub(super) fn test_target(target: Target) {
+    target.check_consistency();
+    assert_eq!(Target::from_json(target.to_json()), Ok(target));
 }
 
 impl Target {