-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix to never have undefined iteration order and lint against it #4665
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -191,7 +188,7 @@ impl EnvironmentRef { | |||
|
|||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)] | |||
pub struct Environment { | |||
bindings: HashMap<String, KclValue>, | |||
bindings: IndexMap<String, KclValue>, |
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.
Any reason to prefer IndexMap over BTreeMap?
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.
BTreeMap keeps things in sorted order according to the key type's Ord
trait. IndexMap preserves insertion order. Unless we want to sort things, insertion order is a better, more intuitive default, in my opinion. For bindings specifically, it will keep variables in the order that they were defined in the KCL source. That's pretty nice.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4665 +/- ##
=======================================
Coverage 85.91% 85.91%
=======================================
Files 81 81
Lines 30117 30117
=======================================
Hits 25876 25876
Misses 4241 4241
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
5977853
to
5a4b691
Compare
Here is the lint: https://rust-lang.github.io/rust-clippy/stable/index.html#/iter_over_hash_type
Now all crates inherit the lints from the workspace.