From 7ec8e51a9f8ef2264d96a1bac468501aaa7e16c2 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 10 May 2018 15:31:40 -0400 Subject: [PATCH] kill get-default run-pass test It no longer passes, and the ui test subsumes it anyhow. --- src/test/run-pass/nll/get_default.rs | 31 ---------------------------- 1 file changed, 31 deletions(-) delete mode 100644 src/test/run-pass/nll/get_default.rs diff --git a/src/test/run-pass/nll/get_default.rs b/src/test/run-pass/nll/get_default.rs deleted file mode 100644 index 13ef907d8d00..000000000000 --- a/src/test/run-pass/nll/get_default.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(nll)] - -use std::collections::HashMap; - -fn get_default(map: &mut HashMap, key: usize) -> &mut String { - match map.get_mut(&key) { - Some(value) => value, - None => { - map.insert(key, "".to_string()); - map.get_mut(&key).unwrap() - } - } -} - -fn main() { - let map = &mut HashMap::new(); - map.insert(22, format!("Hello, world")); - map.insert(44, format!("Goodbye, world")); - assert_eq!(&*get_default(map, 22), "Hello, world"); - assert_eq!(&*get_default(map, 66), ""); -}