Rust skill improvements#115
Merged
kalambet merged 4 commits intoJun 8, 2026
Merged
Conversation
LesnyRumcajs
reviewed
Jun 8, 2026
| - **`unsafe` without a soundness comment.** Every `unsafe` block needs a justification. | ||
| - **Undocumented public items.** A `pub` item with no `///` doc comment ships an unexplained contract. | ||
| - **`dyn Trait` in a hot-path signature** chosen by default rather than measured. | ||
| - **Overengineering.** Reaching for a trait, macro, generic, or `unsafe` before a plain function would do, or optimizing before profiling — the "four horsemen" of bad Rust. Prefer the simplest construct that works. |
Member
There was a problem hiding this comment.
I don't know how well LLM would interpret it. I rarely had issues with those without any additional guidance. I feel it might dumb down code to really something that works but is not really maintainable, i.e., a sea of free functions with 5 boolean params because it works.
Member
Author
There was a problem hiding this comment.
yeah, this is a nice one. So I've updated the description above so it is not contradictory.
LesnyRumcajs
reviewed
Jun 8, 2026
Comment on lines
+60
to
+61
| fn join(parts: &[&str]) -> String // &[T], not &Vec<T> | ||
| fn read(path: impl AsRef<Path>) -> ... // &str / String / &Path / PathBuf all work |
Member
There was a problem hiding this comment.
Please add somewhere an admonition that this must not be used in interfaces so that they are object-safe (or dyn-compatible). Otherwise one would not be able to, e.g., use Box<dyn MyTrait>.
LesnyRumcajs
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@LesnyRumcajs I started to address some of the points.
At first, added the "Idiomatic Rust" references.
But please you and @hanabi1224 please feel free to add more.