-
Notifications
You must be signed in to change notification settings - Fork 125
fmt docstring #2348
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
fmt docstring #2348
Conversation
- fmt
- impl ToJson for @priority_queue.T
Example code formatting inconsistency in test caseCategory inspect(
json.stringify(indent=2),
content=#|{
#| "key": 42
#|}
) Reasoning Documentation examples use assert_eq instead of inspect for consistencyCategory queue.push(1)
inspect(queue.length(), content="1") Reasoning ToJson implementation could handle null values more explicitlyCategory pub impl[A: ToJson + Compare] ToJson for T[A] with to_json(self) {
let arr = []
for x in self {
let json = x.to_json()
arr.push(if json == null { Json::null() } else { json })
}
Json::array(arr)
} Reasoning |
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.
Pull Request Overview
This PR cleans up the priority queue code by updating formatting and extending its functionality with a new JSON serialization implementation. It also updates test examples to use inspect statements and adds a JSON dependency to support the new functionality.
- Added implementation of ToJson for T[A] in both mbti and mbt files.
- Updated tests from assert_eq to inspect for clearer output in examples.
- Updated package configuration to include the JSON module.
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
priority_queue/priority_queue.mbti | Declares a new ToJson implementation for T[A]. |
priority_queue/priority_queue.mbt | Implements the ToJson trait and updates test examples. |
priority_queue/moon.pkg.json | Adds the JSON dependency required for the new implementation. |
priority_queue/README.mbt.md | Adjusts test examples and variable names for clarity. |
json/README.mbt.md | Revises the JSON pretty printing example formatting. |
Pull Request Test Coverage Report for Build 81Details
💛 - Coveralls |
22533ef
to
22b13df
Compare