1
Fork 0

Remove old logging from the tutorial

This commit is contained in:
Alex Crichton 2013-10-22 08:10:34 -07:00
parent 7aa32f7d8e
commit 3ed18bdd42
3 changed files with 21 additions and 21 deletions

View file

@ -700,15 +700,15 @@ mod math {
type complex = (f64, f64); type complex = (f64, f64);
fn sin(f: f64) -> f64 { fn sin(f: f64) -> f64 {
... ...
# fail2!(); # fail!();
} }
fn cos(f: f64) -> f64 { fn cos(f: f64) -> f64 {
... ...
# fail2!(); # fail!();
} }
fn tan(f: f64) -> f64 { fn tan(f: f64) -> f64 {
... ...
# fail2!(); # fail!();
} }
} }
~~~~ ~~~~
@ -1059,8 +1059,8 @@ output slot type would normally be. For example:
~~~~ ~~~~
fn my_err(s: &str) -> ! { fn my_err(s: &str) -> ! {
info2!("{}", s); info!("{}", s);
fail2!(); fail!();
} }
~~~~ ~~~~
@ -1078,7 +1078,7 @@ were declared without the `!` annotation, the following code would not
typecheck: typecheck:
~~~~ ~~~~
# fn my_err(s: &str) -> ! { fail2!() } # fn my_err(s: &str) -> ! { fail!() }
fn f(i: int) -> int { fn f(i: int) -> int {
if i == 42 { if i == 42 {
@ -2826,9 +2826,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
let x: List<int> = Cons(10, @Cons(11, @Nil)); let x: List<int> = Cons(10, @Cons(11, @Nil));
match x { match x {
Cons(_, @Nil) => fail2!("singleton list"), Cons(_, @Nil) => fail!("singleton list"),
Cons(*) => return, Cons(*) => return,
Nil => fail2!("empty list") Nil => fail!("empty list")
} }
~~~~ ~~~~
@ -2864,7 +2864,7 @@ match x {
return; return;
} }
_ => { _ => {
fail2!(); fail!();
} }
} }
~~~~ ~~~~
@ -2918,7 +2918,7 @@ guard may refer to the variables bound within the pattern they follow.
let message = match maybe_digit { let message = match maybe_digit {
Some(x) if x < 10 => process_digit(x), Some(x) if x < 10 => process_digit(x),
Some(x) => process_other(x), Some(x) => process_other(x),
None => fail2!() None => fail!()
}; };
~~~~ ~~~~
@ -3669,10 +3669,10 @@ that demonstrates all four of them:
~~~~ ~~~~
fn main() { fn main() {
error2!("This is an error log") error!("This is an error log")
warn2!("This is a warn log") warn!("This is a warn log")
info2!("this is an info log") info!("this is an info log")
debug2!("This is a debug log") debug!("This is a debug log")
} }
~~~~ ~~~~

View file

@ -226,7 +226,7 @@ match x {
// complicated stuff goes here // complicated stuff goes here
return result + val; return result + val;
}, },
_ => fail2!("Didn't get good_2") _ => fail!("Didn't get good_2")
} }
} }
_ => return 0 // default value _ => return 0 // default value
@ -268,7 +268,7 @@ macro_rules! biased_match (
biased_match!((x) ~ (good_1(g1, val)) else { return 0 }; biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
binds g1, val ) binds g1, val )
biased_match!((g1.body) ~ (good_2(result) ) biased_match!((g1.body) ~ (good_2(result) )
else { fail2!("Didn't get good_2") }; else { fail!("Didn't get good_2") };
binds result ) binds result )
// complicated stuff goes here // complicated stuff goes here
return result + val; return result + val;
@ -369,7 +369,7 @@ macro_rules! biased_match (
# fn f(x: t1) -> uint { # fn f(x: t1) -> uint {
biased_match!( biased_match!(
(x) ~ (good_1(g1, val)) else { return 0 }; (x) ~ (good_1(g1, val)) else { return 0 };
(g1.body) ~ (good_2(result) ) else { fail2!("Didn't get good_2") }; (g1.body) ~ (good_2(result) ) else { fail!("Didn't get good_2") };
binds val, result ) binds val, result )
// complicated stuff goes here // complicated stuff goes here
return result + val; return result + val;

View file

@ -763,7 +763,7 @@ unit, `()`, as the empty tuple if you like).
~~~~ ~~~~
let mytup: (int, int, f64) = (10, 20, 30.0); let mytup: (int, int, f64) = (10, 20, 30.0);
match mytup { match mytup {
(a, b, c) => info2!("{}", a + b + (c as int)) (a, b, c) => info!("{}", a + b + (c as int))
} }
~~~~ ~~~~
@ -779,7 +779,7 @@ For example:
struct MyTup(int, int, f64); struct MyTup(int, int, f64);
let mytup: MyTup = MyTup(10, 20, 30.0); let mytup: MyTup = MyTup(10, 20, 30.0);
match mytup { match mytup {
MyTup(a, b, c) => info2!("{}", a + b + (c as int)) MyTup(a, b, c) => info!("{}", a + b + (c as int))
} }
~~~~ ~~~~
@ -1576,7 +1576,7 @@ arguments.
use std::task::spawn; use std::task::spawn;
do spawn() || { do spawn() || {
debug2!("I'm a task, whatever"); debug!("I'm a task, whatever");
} }
~~~~ ~~~~
@ -1588,7 +1588,7 @@ may be omitted from `do` expressions.
use std::task::spawn; use std::task::spawn;
do spawn { do spawn {
debug2!("Kablam!"); debug!("Kablam!");
} }
~~~~ ~~~~