mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Remove getenv warning
This commit is contained in:
parent
7b973ba827
commit
b0b4136d45
@ -22,7 +22,6 @@ use ext::build::AstBuilder;
|
|||||||
use parse::token;
|
use parse::token;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::os;
|
|
||||||
|
|
||||||
pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||||
-> Box<base::MacResult+'cx> {
|
-> Box<base::MacResult+'cx> {
|
||||||
@ -102,12 +101,12 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let e = match os::getenv(&var) {
|
let e = match env::var_string(&var[]) {
|
||||||
None => {
|
Err(_) => {
|
||||||
cx.span_err(sp, &msg);
|
cx.span_err(sp, &msg);
|
||||||
cx.expr_usize(sp, 0)
|
cx.expr_usize(sp, 0)
|
||||||
}
|
}
|
||||||
Some(s) => cx.expr_str(sp, token::intern_and_get_ident(&s))
|
Ok(s) => cx.expr_str(sp, token::intern_and_get_ident(&s))
|
||||||
};
|
};
|
||||||
MacExpr::new(e)
|
MacExpr::new(e)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user