Skip to content

Commit

Permalink
Merge pull request tock#505 from jrvanwhy/style-list-order
Browse files Browse the repository at this point in the history
Coding style: add a section on list ordering.
  • Loading branch information
jrvanwhy committed Aug 23, 2023
2 parents e80cd7b + e1ab203 commit 571e1c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
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

0 comments on commit 571e1c2

Please sign in to comment.