Skip to content

Commit

Permalink
minor: fix clippy errors (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelatkinson authored Jun 8, 2020
1 parent 3323ed8 commit 991bb40
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/client/auth/scram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fn xor(lhs: &[u8], rhs: &[u8]) -> Vec<u8> {

lhs.iter()
.zip(rhs.iter())
.map(|(l, r)| l.bitxor(r.clone()))
.map(|(l, r)| l.bitxor(r))
.collect()
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ impl ClientOptionsParser {
option
));
}
return Err(ErrorKind::ArgumentError { message: message }.into());
return Err(ErrorKind::ArgumentError { message }.into());
}
}

Expand Down
12 changes: 8 additions & 4 deletions src/cmap/conn/wire/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ impl Header {

/// Reads bytes from `r` and deserializes them into a header.
pub(crate) async fn read_from(stream: &mut AsyncStream) -> Result<Self> {
let length = stream.read_i32().await?;
let request_id = stream.read_i32().await?;
let response_to = stream.read_i32().await?;
let op_code = OpCode::from_i32(stream.read_i32().await?)?;
Ok(Self {
length: stream.read_i32().await?,
request_id: stream.read_i32().await?,
response_to: stream.read_i32().await?,
op_code: OpCode::from_i32(stream.read_i32().await?)?,
length,
request_id,
response_to,
op_code,
})
}
}
2 changes: 1 addition & 1 deletion src/concern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl Serialize for Acknowledgment {
{
match self {
Acknowledgment::Majority => serializer.serialize_str("majority"),
Acknowledgment::Nodes(n) => serializer.serialize_i32(n.clone()),
Acknowledgment::Nodes(n) => serializer.serialize_i32(*n),
Acknowledgment::Custom(name) => serializer.serialize_str(name),
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/operation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ struct CursorInfo {

#[cfg(test)]
mod test {
use std::sync::Arc;

use crate::{
operation::Operation,
options::{ReadPreference, SelectionCriteria},
Expand All @@ -210,9 +208,5 @@ mod test {

let op = constructor(Some(read_pref.clone()));
assert_eq!(op.selection_criteria(), Some(&read_pref));

let predicate = SelectionCriteria::Predicate(Arc::new(|_| true));
let op = constructor(Some(predicate.clone()));
assert_eq!(op.selection_criteria(), Some(&predicate));
}
}
8 changes: 4 additions & 4 deletions src/sdam/description/topology/server_selection/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,25 @@ fn convert_read_preference(test_read_pref: TestReadPreference) -> Option<ReadPre
"Secondary" => ReadPreference::Secondary {
options: ReadPreferenceOptions::builder()
.tag_sets(test_read_pref.tag_sets)
.max_staleness(max_staleness.clone())
.max_staleness(max_staleness)
.build(),
},
"PrimaryPreferred" => ReadPreference::PrimaryPreferred {
options: ReadPreferenceOptions::builder()
.tag_sets(test_read_pref.tag_sets)
.max_staleness(max_staleness.clone())
.max_staleness(max_staleness)
.build(),
},
"SecondaryPreferred" => ReadPreference::SecondaryPreferred {
options: ReadPreferenceOptions::builder()
.tag_sets(test_read_pref.tag_sets)
.max_staleness(max_staleness.clone())
.max_staleness(max_staleness)
.build(),
},
"Nearest" => ReadPreference::Nearest {
options: ReadPreferenceOptions::builder()
.tag_sets(test_read_pref.tag_sets)
.max_staleness(max_staleness.clone())
.max_staleness(max_staleness)
.build(),
},
_ => panic!("invalid read preference: {:?}", test_read_pref),
Expand Down
1 change: 0 additions & 1 deletion src/selection_criteria.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl PartialEq for SelectionCriteria {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::ReadPreference(r1), Self::ReadPreference(r2)) => r1 == r2,
(Self::Predicate(p1), Self::Predicate(p2)) => Arc::ptr_eq(p1, p2),
_ => false,
}
}
Expand Down

0 comments on commit 991bb40

Please sign in to comment.