Skip to content

Code Comment Inconsistency #538

Closed
@YichiZhang0613

Description

@YichiZhang0613

In bson-rust-main/src/bson.rs, the comment indicates that this method will panic when it is called on a case which contains a Decimal128 value, but the code will not panic when input is a Decimal128

    /// Note: If this method is called on a case which contains a `Decimal128` value, it will panic.
    pub fn into_relaxed_extjson(self) -> Value {
        match self {
            Bson::Double(v) if v.is_nan() => {
                let s = if v.is_sign_negative() { "-NaN" } else { "NaN" };

                json!({ "$numberDouble": s })
            }
            ...
            Bson::Decimal128(v) => json!({ "$numberDecimal": v.to_string() }),
            ...
        }
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions