rust-embedded / heapless

Heapless, `static` friendly data structures
Apache License 2.0
1.56k stars 185 forks source link

Rustdoc clippy and typo fixes #512

Closed sourcebox closed 1 month ago

sourcebox commented 1 month ago

Various documentation fixes for warnings shown by running cargo clippy and typos.

sourcebox commented 1 month ago

Changelog already contains an entry about clippy fixes.

Dirbaio commented 1 month ago

lgtm but there's still more clippy failures, could you fix those?

sourcebox commented 1 month ago

lgtm but there's still more clippy failures, could you fix those?

There are 2 lints "a const item should not be interior mutable":

const EMPTY_CELL: Cell<T> = Cell::new(0);
const INIT: UnsafeCell<MaybeUninit<T>> = UnsafeCell::new(MaybeUninit::uninit());

I'm not sure what to do here without breaking something.

sourcebox commented 1 month ago

Clippy docs just suggest to replace const with static.

sourcebox commented 1 month ago

Clippy docs just suggest to replace const with static.

But that doesn't compile, so it's not even an option.

Dirbaio commented 1 month ago

you can remove the const, and do buffer: [const { UnsafeCell::new(MaybeUninit::uninit()) }; N]. this is inline const block, stabilized in 1.79.

sourcebox commented 1 month ago

you can remove the const, and do buffer: [const { UnsafeCell::new(MaybeUninit::uninit()) }; N]. this is inline const block, stabilized in 1.79.

Thanks. Done.

sourcebox commented 1 month ago

Checks are finally all passed.