Skip to content

minor: fix clippy #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Conversation

isabelatkinson
Copy link
Contributor

No description provided.

@@ -27,6 +27,7 @@ fn byte_string_oid() {
}

#[test]
#[allow(clippy::eq_op)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eq_op produces a warning when something is compared to itself, but we need to do that in this test.

@@ -212,7 +212,7 @@ pub(crate) fn deserialize_bson_kvp<R: Read + ?Sized>(
Some(ElementType::Array) => deserialize_array(reader, utf8_lossy).map(Bson::Array)?,
Some(ElementType::Binary) => {
let mut len = read_i32(reader)?;
if len < 0 || len > MAX_BSON_SIZE {
if !(0..=MAX_BSON_SIZE).contains(&len) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I find this far less readable, and it seems like it would be slower (since it has to do a linear search rather than two comparisons), but if clippy wants it this way, who am I to argue?

@isabelatkinson isabelatkinson merged commit 55abdff into mongodb:master Jan 4, 2021
@isabelatkinson isabelatkinson deleted the fix-clippy branch January 4, 2021 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants