about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-09-14 04:07:43 +0200
committerblake2-ppc <blake2-ppc>2013-09-14 04:07:43 +0200
commit830ac37ca2484422bb90ec3e39b8ee47d08dc1be (patch)
tree8811fd8ce35d9274d7d2988063692cf4a2dcded9 /src/libstd/rt
parentb4eff79f389b2c48a21345929c0542385da212df (diff)
downloadrust-830ac37ca2484422bb90ec3e39b8ee47d08dc1be.tar.gz
rust-830ac37ca2484422bb90ec3e39b8ee47d08dc1be.zip
std::logging: Use a more specific enum than Either
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/logging.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs
index 0dd096b5bf3..d0bbf5c0506 100644
--- a/src/libstd/rt/logging.rs
+++ b/src/libstd/rt/logging.rs
@@ -7,7 +7,6 @@
 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
-use either::*;
 use libc::{uintptr_t, exit, STDERR_FILENO};
 use option::{Some, None, Option};
 use rt::util::dumb_println;
@@ -168,14 +167,20 @@ fn update_log_settings(crate_map: *u8, settings: ~str) {
     }
 }
 
+/// Represent a string with `Send` bound.
+pub enum SendableString {
+    OwnedString(~str),
+    StaticString(&'static str)
+}
+
 pub trait Logger {
-    fn log(&mut self, msg: Either<~str, &'static str>);
+    fn log(&mut self, msg: SendableString);
 }
 
 pub struct StdErrLogger;
 
 impl Logger for StdErrLogger {
-    fn log(&mut self, msg: Either<~str, &'static str>) {
+    fn log(&mut self, msg: SendableString) {
         use io::{Writer, WriterUtil};
 
         if !should_log_console() {
@@ -183,14 +188,11 @@ impl Logger for StdErrLogger {
         }
 
         let s: &str = match msg {
-            Left(ref s) => {
-                let s: &str = *s;
-                s
-            }
-            Right(ref s) => {
-                let s: &str = *s;
-                s
-            }
+            OwnedString(ref s) => {
+                let slc: &str = *s;
+                slc
+            },
+            StaticString(s) => s,
         };
 
         // Truncate the string