Skip to content

Commit e6d8625

Browse files
authored
Merge pull request #1002 from wprzytula/appease-clippy
codewide: appease Clippy
2 parents 88bc8c1 + 9754899 commit e6d8625

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

scylla-cql/src/frame/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use thiserror::Error;
1515
use tokio::io::{AsyncRead, AsyncReadExt};
1616
use uuid::Uuid;
1717

18+
use std::fmt::Display;
1819
use std::{collections::HashMap, convert::TryFrom};
1920

2021
use request::SerializableRequest;
@@ -47,11 +48,11 @@ pub enum Compression {
4748
Snappy,
4849
}
4950

50-
impl ToString for Compression {
51-
fn to_string(&self) -> String {
51+
impl Display for Compression {
52+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5253
match self {
53-
Compression::Lz4 => "lz4".to_owned(),
54-
Compression::Snappy => "snappy".to_owned(),
54+
Compression::Lz4 => f.write_str("lz4"),
55+
Compression::Snappy => f.write_str("snappy"),
5556
}
5657
}
5758
}

scylla-cql/src/frame/value.rs

+6
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,12 @@ pub trait ValueList {
699699
}
700700
}
701701

702+
impl Default for LegacySerializedValues {
703+
fn default() -> Self {
704+
Self::new()
705+
}
706+
}
707+
702708
impl LegacySerializedValues {
703709
/// Creates empty value list
704710
pub const fn new() -> Self {

scylla/src/transport/connection_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ impl PoolRefiller {
973973
new_sharder,
974974
);
975975

976-
self.sharder = new_sharder.clone();
976+
self.sharder.clone_from(&new_sharder);
977977

978978
// If the sharder has changed, we can throw away all previous connections.
979979
// All connections to the same live node will have the same sharder,

scylla/src/utils/parse.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::fmt::Display;
2+
13
/// An error that can occur during parsing.
24
#[derive(Copy, Clone)]
35
pub(crate) struct ParseError {
@@ -27,11 +29,11 @@ pub(crate) enum ParseErrorCause {
2729
Other(&'static str),
2830
}
2931

30-
impl ToString for ParseErrorCause {
31-
fn to_string(&self) -> String {
32+
impl Display for ParseErrorCause {
33+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3234
match self {
33-
ParseErrorCause::Expected(e) => format!("expected {:?}", e),
34-
ParseErrorCause::Other(e) => e.to_string(),
35+
ParseErrorCause::Expected(e) => write!(f, "expected {:?}", e),
36+
ParseErrorCause::Other(e) => f.write_str(e),
3537
}
3638
}
3739
}

0 commit comments

Comments
 (0)