Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.41 KB

microcuts.adoc

File metadata and controls

48 lines (31 loc) · 1.41 KB

Microcuts

Minor annoyances I with Rust didn’t have.

Cargo

Directory layout. We should have done directory-per-crate. Collocating lib.rs and main.rs causes confusion. On a similar note, tests and benches should be one crate by default, to save compile times

Complex Semver Requirements Cargo.toml should support only "x.y.z" and "=x.y.z" requirements. Things like < or ~ create ecosystem-wide problems.

Language

Incomplete mod.rs transition. De-facto, both foo/mod.rs and foo.rs are used today. It would probably be better if only one way was allowed.

Nested imports. We now allow use crate::{module::{item}}, which we used not to. As a result, projects are split by the import style they use. Seems better if we sticked with simple one-level nesting only.

Complex Visibility Rules pub(crate) is a lot to type, pub(in …​) doesn’t pull its weight, imports creating item is confusing and not useful. It’d be better to have just pub with the meaning of pub(crate) and pub* for exporting across crate boundary.

Standard library

Ranges

Ranges should be #[derive(Copy), with all fields public.

BinaryHeap

It should be called (and be) a MinHeap, with pop_min instead of pop.

Map

Maps and sets should assert in insert! that the element is new, and use replace to let the user handle the old value.

Error/Err

TryFrom::Error and FromStr::Err are inconsistent.