pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
if let Err(e) = args.workspace(config) {
- let h: HashMap<_, _> = [("invalid", e.to_string())].into();
- config.shell().print_json(&h)?;
+ config.shell().print_json(&HashMap::from([("invalid", e.to_string())]))?;
process::exit(1)
}
- let h: HashMap<_, _> = [("success", "true")].into();
- config.shell().print_json(&h)?;
+ config.shell().print_json(&HashMap::from([("success", "true")]))?;
Ok(())
}
})
.collect::<CargoResult<Vec<_>>>()?;
let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap();
- let patch = [(crates_io_url, patches)].into();
+ let patch = HashMap::from([(crates_io_url, patches)]);
let members = vec![
String::from("library/std"),
String::from("library/core"),
})?
.to_string();
let value = CV::String(str_path, Definition::Cli);
- let map = [("include".to_string(), value)].into();
+ let map = HashMap::from([("include".to_string(), value)]);
CV::Table(map, Definition::Cli)
} else {
// We only want to allow "dotted key" (see https://toml.io/en/v1.0.0#keys)
if let Some(token) = value_map.remove("token") {
if let Vacant(entry) = value_map.entry("registry".into()) {
- let map = [("token".into(), token)].into();
+ let map = HashMap::from([("token".into(), token)]);
let table = CV::Table(map, def.clone());
entry.insert(table);
}
// Move the old token location to the new one.
if let Some(token) = toml.as_table_mut().unwrap().remove("token") {
- let map: HashMap<_, _> = [("token".to_string(), token)].into();
+ let map = HashMap::from([("token".to_string(), token)]);
toml.as_table_mut()
.unwrap()
.insert("registry".into(), map.into());
let (key, mut value) = {
let key = "token".to_string();
let value = ConfigValue::String(token, Definition::Path(file.path().to_path_buf()));
- let map = [(key, value)].into();
+ let map = HashMap::from([(key, value)]);
let table = CV::Table(map, Definition::Path(file.path().to_path_buf()));
if let Some(registry) = registry {
- let map = [(registry.to_string(), table)].into();
+ let map = HashMap::from([(registry.to_string(), table)]);
(
"registries".into(),
CV::Table(map, Definition::Path(file.path().to_path_buf())),