-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
JsValue::to_json
fix integer property keys
#4011
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4011 +/- ##
==========================================
+ Coverage 47.24% 52.79% +5.54%
==========================================
Files 476 480 +4
Lines 46892 46684 -208
==========================================
+ Hits 22154 24645 +2491
+ Misses 24738 22039 -2699 ☔ View full report in Codecov by Sentry. |
.and_then(|x| x.value().cloned()) | ||
{ | ||
Some(val) => val.to_json(context), | ||
None => Ok(Value::Null), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a bit off, but we could avoid the clone
here with extra map
:
.and_then(|x| x.value().map(|v| v.to_json(context)))
{
Some(val) => val?,
None => Value::Null,
};
And similar thing can be done here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the worst case it's still just cloning of a smart pointer so I don't think that it has much overhead costs, but ok, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
This Pull Request fixes #3923