mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-24 13:43:04 +00:00
Move format-ref-cell test
This commit is contained in:
parent
f6a4189d05
commit
5be843fc54
@ -414,3 +414,11 @@ fn refcell_replace_borrows() {
|
||||
let _b = x.borrow();
|
||||
x.replace(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refcell_format() {
|
||||
let name = RefCell::new("rust");
|
||||
let what = RefCell::new("rocks");
|
||||
let msg = format!("{name} {}", &*what.borrow(), name = &*name.borrow());
|
||||
assert_eq!(msg, "rust rocks".to_string());
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
// run-pass
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
pub fn main() {
|
||||
let name = RefCell::new("rust");
|
||||
let what = RefCell::new("rocks");
|
||||
let msg = format!("{name} {}", &*what.borrow(), name=&*name.borrow());
|
||||
assert_eq!(msg, "rust rocks".to_string());
|
||||
}
|
Loading…
Reference in New Issue
Block a user