Skip to content

Commit bb5ff52

Browse files
authored
minor: remove dead_code annotations where possible (#103)
1 parent d8a0b34 commit bb5ff52

File tree

16 files changed

+14
-35
lines changed

16 files changed

+14
-35
lines changed

src/client/auth/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod test;
77

88
use std::{borrow::Cow, str::FromStr};
99

10-
use bson::{Bson, Document};
10+
use bson::Document;
1111
use rand::Rng;
1212
use typed_builder::TypedBuilder;
1313

@@ -198,8 +198,10 @@ pub struct Credential {
198198
}
199199

200200
impl Credential {
201-
#[allow(dead_code)]
201+
#[cfg(test)]
202202
pub(crate) fn into_document(mut self) -> Document {
203+
use bson::Bson;
204+
203205
let mut doc = Document::new();
204206

205207
if let Some(s) = self.username.take() {

src/client/executor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ impl Client {
4848
/// Execute the given operation, optionally specifying a connection used to do so.
4949
/// If no connection is provided, server selection will performed using the criteria specified
5050
/// on the operation, if any.
51-
#[allow(dead_code)]
5251
pub(crate) fn execute_operation<T: Operation>(
5352
&self,
5453
op: &T,

src/client/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,14 @@ impl Client {
166166
}
167167
}
168168

169-
#[allow(dead_code)]
170169
pub(crate) fn send_command_started_event(&self, event: CommandStartedEvent) {
171170
self.emit_command_event(|handler| handler.handle_command_started_event(event.clone()));
172171
}
173172

174-
#[allow(dead_code)]
175173
pub(crate) fn send_command_succeeded_event(&self, event: CommandSucceededEvent) {
176174
self.emit_command_event(|handler| handler.handle_command_succeeded_event(event.clone()));
177175
}
178176

179-
#[allow(dead_code)]
180177
pub(crate) fn send_command_failed_event(&self, event: CommandFailedEvent) {
181178
self.emit_command_event(|handler| handler.handle_command_failed_event(event.clone()));
182179
}

src/operation/count/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Count {
2222
Count { ns, options }
2323
}
2424

25-
#[allow(dead_code)]
25+
#[cfg(test)]
2626
pub(crate) fn empty() -> Self {
2727
Count {
2828
ns: Namespace {

src/operation/create/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) struct Create {
1818
}
1919

2020
impl Create {
21-
#[allow(dead_code)]
21+
#[cfg(test)]
2222
fn empty() -> Self {
2323
Self::new(
2424
Namespace {

src/operation/delete/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub(crate) struct Delete {
2323
}
2424

2525
impl Delete {
26-
#[allow(dead_code)]
26+
#[cfg(test)]
2727
fn empty() -> Self {
2828
Self::new(
2929
Namespace {

src/operation/distinct/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Distinct {
3434
}
3535
}
3636

37-
#[allow(dead_code)]
37+
#[cfg(test)]
3838
pub(crate) fn empty() -> Self {
3939
Distinct {
4040
ns: Namespace {

src/operation/drop_collection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl DropCollection {
2222
DropCollection { ns, options }
2323
}
2424

25-
#[allow(dead_code)]
25+
#[cfg(test)]
2626
fn empty() -> Self {
2727
Self::new(
2828
Namespace {

src/operation/drop_database/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) struct DropDatabase {
1717
}
1818

1919
impl DropDatabase {
20-
#[allow(dead_code)]
20+
#[cfg(test)]
2121
fn empty() -> Self {
2222
Self::new(String::new(), None)
2323
}

src/operation/find/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) struct Find {
2020
}
2121

2222
impl Find {
23-
#[allow(dead_code)]
23+
#[cfg(test)]
2424
fn empty() -> Self {
2525
Self::new(
2626
Namespace {

0 commit comments

Comments
 (0)