From a828e7948069f310dc5b33be8edb65e5e8e0cf9a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 11 Feb 2015 11:47:53 -0800 Subject: std: Tweak the std::env OsString/String interface This commit tweaks the interface of the `std::env` module to make it more ergonomic for common usage: * `env::var` was renamed to `env::var_os` * `env::var_string` was renamed to `env::var` * `env::args` was renamed to `env::args_os` * `env::args` was re-added as a panicking iterator over string values * `env::vars` was renamed to `env::vars_os` * `env::vars` was re-added as a panicking iterator over string values. This should make common usage (e.g. unicode values everywhere) more ergonomic as well as "the default". This is also a breaking change due to the differences of what's yielded from each of these functions, but migration should be fairly easy as the defaults operate over `String` which is a common type to use. [breaking-change] --- src/libsyntax/ext/env.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/env.rs b/src/libsyntax/ext/env.rs index ef9d3799879..5d56707c87a 100644 --- a/src/libsyntax/ext/env.rs +++ b/src/libsyntax/ext/env.rs @@ -30,7 +30,7 @@ pub fn expand_option_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenT Some(v) => v }; - let e = match env::var_string(&var[]) { + let e = match env::var(&var[]) { Err(..) => { cx.expr_path(cx.path_all(sp, true, @@ -101,7 +101,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) } } - let e = match env::var_string(&var[]) { + let e = match env::var(&var[]) { Err(_) => { cx.span_err(sp, &msg); cx.expr_usize(sp, 0) -- cgit 1.4.1-3-g733a5