Skip to content

Commit 4ce513a

Browse files
committed
fix clippy
1 parent b8c2e90 commit 4ce513a

File tree

5 files changed

+12
-23
lines changed

5 files changed

+12
-23
lines changed

macros/src/option.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ pub fn option_setters(
9292
});
9393
// Append setter fns to `impl` block item list
9494
for OptInfo { name, attrs, type_ } in opt_info {
95-
if args
96-
.skip
97-
.as_ref()
98-
.map_or(false, |skip| skip.contains(&name))
99-
{
95+
if args.skip.as_ref().is_some_and(|skip| skip.contains(&name)) {
10096
continue;
10197
}
10298
let (accept, value) = if type_.is_ident("String")

src/client/auth/oidc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ pub(super) fn validate_credential(credential: &Credential) -> Result<()> {
978978
#[cfg(test)]
979979
if environment
980980
.as_ref()
981-
.map_or(false, |ev| *ev == TEST_ENVIRONMENT_VALUE_STR)
981+
.is_ok_and(|ev| *ev == TEST_ENVIRONMENT_VALUE_STR)
982982
&& credential.username.is_some()
983983
{
984984
return Err(Error::invalid_argument(format!(

src/sdam/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async fn hello_ok_true() {
192192
event_stream
193193
.next_match(Duration::from_millis(2000), |event| {
194194
if let Event::Sdam(SdamEvent::ServerHeartbeatSucceeded(e)) = event {
195-
assert_eq!(e.reply.get_bool("helloOk").unwrap(), true);
195+
assert!(e.reply.get_bool("helloOk").unwrap());
196196
assert!(e.reply.get(LEGACY_HELLO_COMMAND_NAME_LOWERCASE).is_some());
197197
assert!(e.reply.get("isWritablePrimary").is_none());
198198
return true;

src/test/index_management/search_index.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ async fn search_index_create_list() {
3636
let found = 'outer: loop {
3737
let mut cursor = coll0.list_search_indexes().await.unwrap();
3838
while let Some(d) = cursor.try_next().await.unwrap() {
39-
if d.get_str("name")
40-
.map_or(false, |n| n == "test-search-index")
39+
if d.get_str("name").is_ok_and(|n| n == "test-search-index")
4140
&& d.get_bool("queryable").unwrap_or(false)
4241
{
4342
break 'outer d;
@@ -87,14 +86,11 @@ async fn search_index_create_multiple() {
8786
loop {
8887
let mut cursor = coll0.list_search_indexes().await.unwrap();
8988
while let Some(d) = cursor.try_next().await.unwrap() {
90-
if d.get_str("name")
91-
.map_or(false, |n| n == "test-search-index-1")
89+
if d.get_str("name").is_ok_and(|n| n == "test-search-index-1")
9290
&& d.get_bool("queryable").unwrap_or(false)
9391
{
9492
index1 = Some(d);
95-
} else if d
96-
.get_str("name")
97-
.map_or(false, |n| n == "test-search-index-2")
93+
} else if d.get_str("name").is_ok_and(|n| n == "test-search-index-2")
9894
&& d.get_bool("queryable").unwrap_or(false)
9995
{
10096
index2 = Some(d);
@@ -145,8 +141,7 @@ async fn search_index_drop() {
145141
'outer: loop {
146142
let mut cursor = coll0.list_search_indexes().await.unwrap();
147143
while let Some(d) = cursor.try_next().await.unwrap() {
148-
if d.get_str("name")
149-
.map_or(false, |n| n == "test-search-index")
144+
if d.get_str("name").is_ok_and(|n| n == "test-search-index")
150145
&& d.get_bool("queryable").unwrap_or(false)
151146
{
152147
break 'outer;
@@ -198,8 +193,7 @@ async fn search_index_update() {
198193
'outer: loop {
199194
let mut cursor = coll0.list_search_indexes().await.unwrap();
200195
while let Some(d) = cursor.try_next().await.unwrap() {
201-
if d.get_str("name")
202-
.map_or(false, |n| n == "test-search-index")
196+
if d.get_str("name").is_ok_and(|n| n == "test-search-index")
203197
&& d.get_bool("queryable").unwrap_or(false)
204198
{
205199
break 'outer;
@@ -222,10 +216,9 @@ async fn search_index_update() {
222216
let found = 'find: loop {
223217
let mut cursor = coll0.list_search_indexes().await.unwrap();
224218
while let Some(d) = cursor.try_next().await.unwrap() {
225-
if d.get_str("name")
226-
.map_or(false, |n| n == "test-search-index")
219+
if d.get_str("name").is_ok_and(|n| n == "test-search-index")
227220
&& d.get_bool("queryable").unwrap_or(false)
228-
&& d.get_str("status").map_or(false, |s| s == "READY")
221+
&& d.get_str("status").is_ok_and(|s| s == "READY")
229222
{
230223
break 'find d;
231224
}
@@ -259,7 +252,7 @@ async fn wait_for_index(coll: &Collection<Document>, name: &str) -> Document {
259252
while Instant::now() < deadline {
260253
let mut cursor = coll.list_search_indexes().name(name).await.unwrap();
261254
while let Some(def) = cursor.try_next().await.unwrap() {
262-
if def.get_str("name").map_or(false, |n| n == name)
255+
if def.get_str("name").is_ok_and(|n| n == name)
263256
&& def.get_bool("queryable").unwrap_or(false)
264257
{
265258
return def;

src/test/spec/retryable_writes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async fn retry_write_retryable_write_error() {
247247
if let CommandEvent::Succeeded(ev) = &*msg {
248248
if let Some(Bson::Document(wc_err)) = ev.reply.get("writeConcernError") {
249249
if ev.command_name == "insert"
250-
&& wc_err.get_i32("code").map_or(false, |c| c == 91)
250+
&& wc_err.get_i32("code").is_ok_and(|c| c == 91)
251251
{
252252
// Spawn a new task so events continue to process
253253
let client = client.clone();

0 commit comments

Comments
 (0)