Skip to content

Rust skill improvements#115

Merged
kalambet merged 4 commits into
peter/agentic-handbook-overhaulfrom
peter/rust-improvements
Jun 8, 2026
Merged

Rust skill improvements#115
kalambet merged 4 commits into
peter/agentic-handbook-overhaulfrom
peter/rust-improvements

Conversation

@kalambet

@kalambet kalambet commented Jun 3, 2026

Copy link
Copy Markdown
Member

@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.

@kalambet
kalambet requested a review from LesnyRumcajs June 3, 2026 13:46
@kalambet
kalambet requested a review from hanabi1224 as a code owner June 3, 2026 13:46
Comment thread languages/rust/architect.md Outdated
- **`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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is a nice one. So I've updated the description above so it is not contradictory.

Comment thread languages/rust/idioms.md
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>.

@kalambet
kalambet merged commit 40ee0e2 into peter/agentic-handbook-overhaul Jun 8, 2026
1 check passed
@kalambet
kalambet deleted the peter/rust-improvements branch June 8, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants