about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-14 08:50:50 -0700
committerbors <bors@rust-lang.org>2013-09-14 08:50:50 -0700
commit1c26513ef9a58fa3e6703320cc37427aa229bbbd (patch)
tree2d769c50c2a442c6f3fd0773fa5106ba51af10f6 /src/libstd/rt
parent5d905f1314d243eb1572588f7e7e98768f8bb711 (diff)
parent15c9dc7a86d14f4aba3e23f91af65671aa4b5001 (diff)
downloadrust-1c26513ef9a58fa3e6703320cc37427aa229bbbd.tar.gz
rust-1c26513ef9a58fa3e6703320cc37427aa229bbbd.zip
auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphism
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
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