Remove remaining uses of `[]`. This time I tried to use deref coercions where possible.
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 93a25de..efc12d0 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -311,19 +311,19 @@
match (value, opt_type_desc) {
(Some(..), None) => {
early_error(&format!("{} option `{}` takes no \
- value", $outputname, key)[])
+ value", $outputname, key))
}
(None, Some(type_desc)) => {
early_error(&format!("{0} option `{1}` requires \
{2} ({3} {1}=<value>)",
$outputname, key,
- type_desc, $prefix)[])
+ type_desc, $prefix))
}
(Some(value), Some(type_desc)) => {
early_error(&format!("incorrect value `{}` for {} \
option `{}` - {} was expected",
value, $outputname,
- key, type_desc)[])
+ key, type_desc))
}
(None, None) => unreachable!()
}
@@ -333,7 +333,7 @@
}
if !found {
early_error(&format!("unknown {} option: `{}`",
- $outputname, key)[]);
+ $outputname, key));
}
}
return op;
@@ -590,10 +590,10 @@
pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
use syntax::parse::token::intern_and_get_ident as intern;
- let end = &sess.target.target.target_endian[];
- let arch = &sess.target.target.arch[];
- let wordsz = &sess.target.target.target_pointer_width[];
- let os = &sess.target.target.target_os[];
+ let end = &sess.target.target.target_endian;
+ let arch = &sess.target.target.arch;
+ let wordsz = &sess.target.target.target_pointer_width;
+ let os = &sess.target.target.target_os;
let fam = match sess.target.target.options.is_like_windows {
true => InternedString::new("windows"),
@@ -634,18 +634,18 @@
}
pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config {
- let target = match Target::search(&opts.target_triple[]) {
+ let target = match Target::search(&opts.target_triple) {
Ok(t) => t,
Err(e) => {
sp.handler().fatal(&format!("Error loading target specification: {}", e));
}
};
- let (int_type, uint_type) = match &target.target_pointer_width[] {
+ let (int_type, uint_type) = match &target.target_pointer_width[..] {
"32" => (ast::TyI32, ast::TyU32),
"64" => (ast::TyI64, ast::TyU64),
w => sp.handler().fatal(&format!("target specification was invalid: unrecognized \
- target-pointer-width {}", w)[])
+ target-pointer-width {}", w))
};
Config {
@@ -863,7 +863,7 @@
"dep-info" => OutputTypeDepInfo,
_ => {
early_error(&format!("unknown emission type: `{}`",
- part)[])
+ part))
}
};
output_types.push(output_type)
@@ -955,7 +955,7 @@
(_, s) => {
early_error(&format!("unknown library kind `{}`, expected \
one of dylib, framework, or static",
- s)[]);
+ s));
}
};
(name.to_string(), kind)
@@ -991,7 +991,7 @@
Some(arg) => {
early_error(&format!("argument for --color must be auto, always \
or never (instead was `{}`)",
- arg)[])
+ arg))
}
};
@@ -1111,7 +1111,7 @@
#[test]
fn test_switch_implies_cfg_test() {
let matches =
- &match getopts(&["--test".to_string()], &optgroups()[]) {
+ &match getopts(&["--test".to_string()], &optgroups()) {
Ok(m) => m,
Err(f) => panic!("test_switch_implies_cfg_test: {}", f)
};
@@ -1128,7 +1128,7 @@
fn test_switch_implies_cfg_test_unless_cfg_test() {
let matches =
&match getopts(&["--test".to_string(), "--cfg=test".to_string()],
- &optgroups()[]) {
+ &optgroups()) {
Ok(m) => m,
Err(f) => {
panic!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
@@ -1148,7 +1148,7 @@
{
let matches = getopts(&[
"-Awarnings".to_string()
- ], &optgroups()[]).unwrap();
+ ], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);
@@ -1159,7 +1159,7 @@
let matches = getopts(&[
"-Awarnings".to_string(),
"-Dwarnings".to_string()
- ], &optgroups()[]).unwrap();
+ ], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);
@@ -1169,7 +1169,7 @@
{
let matches = getopts(&[
"-Adead_code".to_string()
- ], &optgroups()[]).unwrap();
+ ], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);