Skip to content

Commit

Permalink
Merge pull request #1002 from wprzytula/appease-clippy
Browse files Browse the repository at this point in the history
codewide: appease Clippy
  • Loading branch information
wprzytula authored May 21, 2024
2 parents 88bc8c1 + 9754899 commit e6d8625
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
9 changes: 5 additions & 4 deletions scylla-cql/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use thiserror::Error;
use tokio::io::{AsyncRead, AsyncReadExt};
use uuid::Uuid;

use std::fmt::Display;
use std::{collections::HashMap, convert::TryFrom};

use request::SerializableRequest;
Expand Down Expand Up @@ -47,11 +48,11 @@ pub enum Compression {
Snappy,
}

impl ToString for Compression {
fn to_string(&self) -> String {
impl Display for Compression {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Compression::Lz4 => "lz4".to_owned(),
Compression::Snappy => "snappy".to_owned(),
Compression::Lz4 => f.write_str("lz4"),
Compression::Snappy => f.write_str("snappy"),
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions scylla-cql/src/frame/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ pub trait ValueList {
}
}

impl Default for LegacySerializedValues {
fn default() -> Self {
Self::new()
}
}

impl LegacySerializedValues {
/// Creates empty value list
pub const fn new() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion scylla/src/transport/connection_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl PoolRefiller {
new_sharder,
);

self.sharder = new_sharder.clone();
self.sharder.clone_from(&new_sharder);

// If the sharder has changed, we can throw away all previous connections.
// All connections to the same live node will have the same sharder,
Expand Down
10 changes: 6 additions & 4 deletions scylla/src/utils/parse.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Display;

/// An error that can occur during parsing.
#[derive(Copy, Clone)]
pub(crate) struct ParseError {
Expand Down Expand Up @@ -27,11 +29,11 @@ pub(crate) enum ParseErrorCause {
Other(&'static str),
}

impl ToString for ParseErrorCause {
fn to_string(&self) -> String {
impl Display for ParseErrorCause {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ParseErrorCause::Expected(e) => format!("expected {:?}", e),
ParseErrorCause::Other(e) => e.to_string(),
ParseErrorCause::Expected(e) => write!(f, "expected {:?}", e),
ParseErrorCause::Other(e) => f.write_str(e),
}
}
}
Expand Down

0 comments on commit e6d8625

Please sign in to comment.