New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generics1: does not require use of explicit generics #1448
Comments
I agree with you. Maybe the thought process at the time of writing was
let mut shopping_list: Vec<&str> = Vec::new();
Again, I do agree with you, but this is the conclusion I drew after reading |
I see two options here:
|
I'd lean towards the latter option myself. |
I agree with this too |
Hi, I found this example of generics and the turbofish operator. // generics
fn get_default_value<T>() -> T
where
T: Default,
{
Default::default()
}
fn main() {
let number_default_value = get_default_value::<i32>();
println!("Default value of i32: {}", number_default_value);
} I would like to get you guys's opinions. I'm not sure on this because it uses the |
The idiomatic solution for
generics1
is to simply remove the explicit type from the variable binding since it can be inferred:The hint says:
Two problems with this:
The text was updated successfully, but these errors were encountered: