diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-09-04 17:05:31 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-09-04 23:09:51 -0400 |
| commit | b49e9fa794addc197e58743bdc120cb9740b73c0 (patch) | |
| tree | 871cb27ab7a5fe68de7aced2ce22794bb9011f1b /src/libextra | |
| parent | 8827b94e5b02d8f0c9d1d9858f3e387e55711dd4 (diff) | |
| download | rust-b49e9fa794addc197e58743bdc120cb9740b73c0.tar.gz rust-b49e9fa794addc197e58743bdc120cb9740b73c0.zip | |
forbid cast as bool
This is currently unsound since `bool` is represented as `i8`. It will become sound when `bool` is stored as `i8` but always used as `i1`. However, the current behaviour will always be identical to `x & 1 != 0`, so there's no need for it. It's also surprising, since `x != 0` is the expected behaviour. Closes #7311
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/ebml.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libextra/ebml.rs b/src/libextra/ebml.rs index 3527a7b5e55..d8d54e20e97 100644 --- a/src/libextra/ebml.rs +++ b/src/libextra/ebml.rs @@ -410,7 +410,7 @@ pub mod reader { } fn read_bool(&mut self) -> bool { - doc_as_u8(self.next_doc(EsBool)) as bool + doc_as_u8(self.next_doc(EsBool)) != 0 } fn read_f64(&mut self) -> f64 { |
