Use ..Default::default() with a struct constructor (#3068)
As @jtran pointed out - I had misunderstood the behavior of Default::default(), we can instead rely on this syntax to do the same thing. This won't use each field's default value -- rather, it'll use the type's Default, and override each field. Neat! Signed-off-by: Paul Tagliamonte <paul@zoo.dev>
This commit is contained in:
@ -160,19 +160,13 @@ impl EngineConnection {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::field_reassign_with_default)]
|
||||
pub async fn new(ws: reqwest::Upgraded) -> Result<EngineConnection> {
|
||||
// allowing the field_reassign_with_default lint here because the
|
||||
// defaults for this object don't match the type defaults. We want
|
||||
// to inherent the default config
|
||||
//
|
||||
// See the `impl Default for WebSocketConfig` in
|
||||
// `tungstenite/protocol/mod.rs`
|
||||
|
||||
let mut wsconfig = tokio_tungstenite::tungstenite::protocol::WebSocketConfig::default();
|
||||
// 4294967296 bytes, which is around 4.2 GB.
|
||||
wsconfig.max_message_size = Some(0x100000000);
|
||||
wsconfig.max_frame_size = Some(0x100000000);
|
||||
let wsconfig = tokio_tungstenite::tungstenite::protocol::WebSocketConfig {
|
||||
// 4294967296 bytes, which is around 4.2 GB.
|
||||
max_message_size: Some(0x100000000),
|
||||
max_frame_size: Some(0x100000000),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let ws_stream = tokio_tungstenite::WebSocketStream::from_raw_socket(
|
||||
ws,
|
||||
|
Reference in New Issue
Block a user