about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-02 18:44:30 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-03 08:31:44 -0800
commit68e7dd0ffe45d679a36e81a767dc6d4aa13dbf94 (patch)
tree444e33d03b00fbfd7e64d13c06cda95554daad38
parent6478fcfafe390355c4cc2f7e22cfbf4cd1f5eeee (diff)
parente23f5c8e2630fc9df7e54911eae0746edccd30aa (diff)
downloadrust-68e7dd0ffe45d679a36e81a767dc6d4aa13dbf94.tar.gz
rust-68e7dd0ffe45d679a36e81a767dc6d4aa13dbf94.zip
rollup merge of #18476 : vadimcn/17982
-rw-r--r--src/libterm/win.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libterm/win.rs b/src/libterm/win.rs
index 7ce6fb658b5..9a67ee8836b 100644
--- a/src/libterm/win.rs
+++ b/src/libterm/win.rs
@@ -71,8 +71,7 @@ fn color_to_bits(color: color::Color) -> u16 {
 }
 
 fn bits_to_color(bits: u16) -> color::Color {
-    let bits = bits & 0x7;
-    let color = match bits {
+    let color = match bits & 0x7 {
         0 => color::BLACK,
         0x1 => color::BLUE,
         0x2 => color::GREEN,
@@ -84,11 +83,7 @@ fn bits_to_color(bits: u16) -> color::Color {
         _ => unreachable!()
     };
 
-    if bits >= 8 {
-        color | 0x8
-    } else {
-        color
-    }
+    color | (bits & 0x8) // copy the hi-intensity bit
 }
 
 impl<T: Writer+Send> WinConsole<T> {