Remove old logging from the tutorial
This commit is contained in:
parent
7aa32f7d8e
commit
3ed18bdd42
28
doc/rust.md
28
doc/rust.md
|
@ -700,15 +700,15 @@ mod math {
|
|||
type complex = (f64, f64);
|
||||
fn sin(f: f64) -> f64 {
|
||||
...
|
||||
# fail2!();
|
||||
# fail!();
|
||||
}
|
||||
fn cos(f: f64) -> f64 {
|
||||
...
|
||||
# fail2!();
|
||||
# fail!();
|
||||
}
|
||||
fn tan(f: f64) -> f64 {
|
||||
...
|
||||
# fail2!();
|
||||
# fail!();
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
@ -1059,8 +1059,8 @@ output slot type would normally be. For example:
|
|||
|
||||
~~~~
|
||||
fn my_err(s: &str) -> ! {
|
||||
info2!("{}", s);
|
||||
fail2!();
|
||||
info!("{}", s);
|
||||
fail!();
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ were declared without the `!` annotation, the following code would not
|
|||
typecheck:
|
||||
|
||||
~~~~
|
||||
# fn my_err(s: &str) -> ! { fail2!() }
|
||||
# fn my_err(s: &str) -> ! { fail!() }
|
||||
|
||||
fn f(i: int) -> int {
|
||||
if i == 42 {
|
||||
|
@ -2826,9 +2826,9 @@ enum List<X> { Nil, Cons(X, @List<X>) }
|
|||
let x: List<int> = Cons(10, @Cons(11, @Nil));
|
||||
|
||||
match x {
|
||||
Cons(_, @Nil) => fail2!("singleton list"),
|
||||
Cons(_, @Nil) => fail!("singleton list"),
|
||||
Cons(*) => return,
|
||||
Nil => fail2!("empty list")
|
||||
Nil => fail!("empty list")
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
@ -2864,7 +2864,7 @@ match x {
|
|||
return;
|
||||
}
|
||||
_ => {
|
||||
fail2!();
|
||||
fail!();
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
@ -2918,7 +2918,7 @@ guard may refer to the variables bound within the pattern they follow.
|
|||
let message = match maybe_digit {
|
||||
Some(x) if x < 10 => process_digit(x),
|
||||
Some(x) => process_other(x),
|
||||
None => fail2!()
|
||||
None => fail!()
|
||||
};
|
||||
~~~~
|
||||
|
||||
|
@ -3669,10 +3669,10 @@ that demonstrates all four of them:
|
|||
|
||||
~~~~
|
||||
fn main() {
|
||||
error2!("This is an error log")
|
||||
warn2!("This is a warn log")
|
||||
info2!("this is an info log")
|
||||
debug2!("This is a debug log")
|
||||
error!("This is an error log")
|
||||
warn!("This is a warn log")
|
||||
info!("this is an info log")
|
||||
debug!("This is a debug log")
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ match x {
|
|||
// complicated stuff goes here
|
||||
return result + val;
|
||||
},
|
||||
_ => fail2!("Didn't get good_2")
|
||||
_ => fail!("Didn't get good_2")
|
||||
}
|
||||
}
|
||||
_ => return 0 // default value
|
||||
|
@ -268,7 +268,7 @@ macro_rules! biased_match (
|
|||
biased_match!((x) ~ (good_1(g1, val)) else { return 0 };
|
||||
binds g1, val )
|
||||
biased_match!((g1.body) ~ (good_2(result) )
|
||||
else { fail2!("Didn't get good_2") };
|
||||
else { fail!("Didn't get good_2") };
|
||||
binds result )
|
||||
// complicated stuff goes here
|
||||
return result + val;
|
||||
|
@ -369,7 +369,7 @@ macro_rules! biased_match (
|
|||
# fn f(x: t1) -> uint {
|
||||
biased_match!(
|
||||
(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 )
|
||||
// complicated stuff goes here
|
||||
return result + val;
|
||||
|
|
|
@ -763,7 +763,7 @@ unit, `()`, as the empty tuple if you like).
|
|||
~~~~
|
||||
let mytup: (int, int, f64) = (10, 20, 30.0);
|
||||
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);
|
||||
let mytup: MyTup = MyTup(10, 20, 30.0);
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
do spawn {
|
||||
debug2!("Kablam!");
|
||||
debug!("Kablam!");
|
||||
}
|
||||
~~~~
|
||||
|
||||
|
|
Loading…
Reference in New Issue