Skip to content
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

Coding style: add a section on list ordering. #505

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ libtock_temperature = { path = "apis/temperature" }
libtock_build_scripts = { path = "build_scripts"}

[profile.dev]
panic = "abort"
lto = true
debug = true
lto = true
panic = "abort"

[profile.release]
panic = "abort"
lto = true
debug = true
lto = true
panic = "abort"

[workspace]
exclude = ["tock"]
members = [
"apis/adc",
"apis/air_quality",
"apis/alarm",
"apis/gpio",
"apis/ambient_light",
"apis/buttons",
"apis/buzzer",
"apis/console",
"apis/gpio",
"apis/leds",
"apis/low_level_debug",
"apis/ninedof",
"apis/proximity",
"apis/temperature",
"apis/ambient_light",
"panic_handlers/debug_panic",
"panic_handlers/small_panic",
"platform",
Expand Down
15 changes: 15 additions & 0 deletions doc/Style.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Coding Style
============

## List Ordering

Source code tends to contain many lists whose order is unimportant, such as
dependency lists in `Cargo.toml` and `mod` declarations in `.rs` files. When
there isn't a better reason to prefer a particular order, these lists should be
in alphabetical order.

Benefits:

1. When lists become long, this makes it easier to search for a particular
entry.
2. Always adding new entries at the bottom of the list results in merge
conflicts whenever two PRs add entries to the same list. Putting them in
alphabetical order decreases the probability of merge conflicts.

## Naming Conventions

Many things in `libtock-rs` live outside Rust's namespacing system, and can
Expand Down