Default::default()
RS-W1051T::default
, over trait function Default::default()
104 context,
105 premium_level: Arc::new(AtomicU8::new(0)),
106 verbose: Arc::new(AtomicBool::new(false)),
107 language: Arc::new(Default::default()),108 transcript_results: record_transcriptions.then(|| Arc::new(RwLock::new(Vec::new()))),
109 seen_users: record_transcriptions
110 .then(|| Arc::new(DashSet::with_hasher(RandomState::new()))),
Calls to Default::default()
are less readable than T::default()
.
Using the name of the type makes it easier for the reader to discern which type is being used.
struct Foo {
s : String
}
impl Foo {
pub fn new() -> Foo {
Foo {
s : Default::default()
}
}
}
struct Foo {
s : String
}
impl Foo {
pub fn new() -> Foo {
Foo {
s : String::default()
}
}
}