Hello. Wondering the idiomatic way of concatenation in rust. Specifically, I am constructing a url based on some CLI command inputs.
#[derive(StructOpt, Debug)]
struct Cli {
attributes: String,
id: String,
}
fn main() -> Result<(), Error> {
let args = Cli::from_args();
let url = format!("http://swapi.dev/api/{}/{}", args.attributes, args.id);
let url = String::from("http://swapi.dev/api/") + &args.attributes + "/" + &args.id;
... etc
}
Which one is idiomatic? Is there another way of doing this that is "better"?