2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2018-09-06 12:41:12 +00:00
|
|
|
|
2017-11-13 19:27:58 +00:00
|
|
|
use std::fmt::Display;
|
|
|
|
|
|
|
|
fn foo(f: impl Display + Clone) -> String {
|
|
|
|
let g = f.clone();
|
|
|
|
format!("{} + {}", f, g)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let sum = foo(format!("22"));
|
|
|
|
assert_eq!(sum, r"22 + 22");
|
|
|
|
}
|