Closed
Description
When deprecated API usage is enclosed in a macro like try!
, no warning is raised. However, using it directly in match
does.
Below is an example using the deprecated url
crate from rust nightly distribution. A warning is raised only in the use_match
function.
extern crate url;
use url::Url;
fn main() {
println!("Host: {}", use_try("http://localhost").unwrap())
println!("Host: {}", use_match("http://localhost").unwrap())
}
fn use_try(s: &str) -> Result<String, String> {
let u = try!(Url::parse(s));
Ok(u.host)
}
fn use_match(s: &str) -> Result<String, String> {
return match Url::parse(s) {
Ok(u) => Ok(u.host),
Err(e) => Err(e)
}
}