}
fn transform(x: Option<int>) -> Option<String> {
- x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_string()) )
+ x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_string()) )
}
pub fn main() {
assert_eq!(transform(Some(10)), Some("11".to_string()));
assert_eq!(transform(None), None);
assert!((vec!("hi".to_string()))
- .bind(|x| vec!(x.clone(), format_strbuf!("{}!", x)) )
- .bind(|x| vec!(x.clone(), format_strbuf!("{}?", x)) ) ==
+ .bind(|x| vec!(x.clone(), format!("{}!", x)) )
+ .bind(|x| vec!(x.clone(), format!("{}?", x)) ) ==
vec!("hi".to_string(),
"hi?".to_string(),
"hi!".to_string(),