can't call assert_eq on packed struct fields since that takes references

This commit is contained in:
Oliver Schneider 2017-01-31 10:51:52 +01:00
parent d3e9e51d67
commit a3d83e5c8f

View File

@ -9,6 +9,11 @@ fn main() {
a: 42,
b: 99,
};
assert_eq!(x.a, 42);
assert_eq!(x.b, 99);
let a = x.a;
let b = x.b;
assert_eq!(a, 42);
assert_eq!(b, 99);
// can't do `assert_eq!(x.a, 42)`, because `assert_eq!` takes a reference
assert_eq!({x.a}, 42);
assert_eq!({x.b}, 99);
}