about summary refs log tree commit diff
path: root/src/libsyntax/print
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2013-05-06 00:18:51 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2013-05-14 16:36:23 +0200
commitbdc182cc41c2741edc6fdc4ec09b8522479aab40 (patch)
treee4d26bbc1b47702ef46cd01bbaa5b5dad8633416 /src/libsyntax/print
parent84745b483f322671f894b9e8d0a462c46275a9d3 (diff)
downloadrust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.tar.gz
rust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.zip
Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
Diffstat (limited to 'src/libsyntax/print')
-rw-r--r--src/libsyntax/print/pprust.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 2e7c35807e5..65e4cdb53ab 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -430,10 +430,10 @@ pub fn print_type(s: @ps, ty: @ast::Ty) {
         word(s.s, ~"]");
       }
       ast::ty_mac(_) => {
-          fail!(~"print_type doesn't know how to print a ty_mac");
+          fail!("print_type doesn't know how to print a ty_mac");
       }
       ast::ty_infer => {
-          fail!(~"print_type shouldn't see a ty_infer");
+          fail!("print_type shouldn't see a ty_infer");
       }
 
     }
@@ -683,7 +683,7 @@ pub fn print_struct(s: @ps,
             popen(s);
             do commasep(s, inconsistent, struct_def.fields) |s, field| {
                 match field.node.kind {
-                    ast::named_field(*) => fail!(~"unexpected named field"),
+                    ast::named_field(*) => fail!("unexpected named field"),
                     ast::unnamed_field => {
                         maybe_print_comment(s, field.span.lo);
                         print_type(s, field.node.ty);
@@ -702,7 +702,7 @@ pub fn print_struct(s: @ps,
 
         for struct_def.fields.each |field| {
             match field.node.kind {
-                ast::unnamed_field => fail!(~"unexpected unnamed field"),
+                ast::unnamed_field => fail!("unexpected unnamed field"),
                 ast::named_field(ident, visibility) => {
                     hardbreak_if_not_bol(s);
                     maybe_print_comment(s, field.span.lo);
@@ -984,7 +984,7 @@ pub fn print_if(s: @ps, test: @ast::expr, blk: &ast::blk,
               }
               // BLEAH, constraints would be great here
               _ => {
-                  fail!(~"print_if saw if with weird alternative");
+                  fail!("print_if saw if with weird alternative");
               }
             }
           }
@@ -2237,7 +2237,7 @@ mod test {
 
     fn string_check<T:Eq> (given : &T, expected: &T) {
         if !(given == expected) {
-            fail!(fmt!("given %?, expected %?",given,expected));
+            fail!("given %?, expected %?",given,expected);
         }
     }