summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md16
-rw-r--r--src/db/model/state.rs2
-rw-r--r--src/db/settings.rs4
-rw-r--r--src/db/world.rs4
4 files changed, 23 insertions, 3 deletions
diff --git a/README.md b/README.md
index a8a59bb..0bac6ca 100644
--- a/README.md
+++ b/README.md
@@ -123,6 +123,22 @@ python3 tools/arch-census.py # the numbers; --list-dead names them, --budget
python3 tools/arch-census.py --list-overwide # pub(crate) items wider than anything reaches
```
+Formatting and idiom are gates too, not opinions:
+
+```
+cargo fmt --all -- --check # rustfmt.toml: 120 columns, small items on one line
+cargo clippy --all-targets --all-features -- -D warnings
+cargo clippy --release --lib --bins -- -D warnings
+```
+
+`[lints.clippy]` in `Cargo.toml` names the idiom lints the tree holds itself to;
+`must_use_candidate` and `missing_errors_doc` are left out on purpose, because
+satisfying them would add doc-comment boilerplate rather than remove it. The
+release-mode check is not a duplicate of the other: `--all-targets` pulls
+`test-support` in through the dev-dependency, and an item that is `pub` under
+that feature is `pub(crate)` without it — so only the release build sees what
+clippy says about an item once it is crate-internal.
+
## Testing without root, network, or a real chroot
`cargo test` runs the whole thing on an ordinary user account. Two mechanisms
diff --git a/src/db/model/state.rs b/src/db/model/state.rs
index 0eb9b6e..f3a3574 100644
--- a/src/db/model/state.rs
+++ b/src/db/model/state.rs
@@ -92,7 +92,7 @@ impl ReleaseState {
const ALL: &'static [ReleaseState] =
&[ReleaseState::Published, ReleaseState::Withdrawn, ReleaseState::FailedUnbuilt];
- pub fn as_str(&self) -> &'static str {
+ pub fn as_str(self) -> &'static str {
match self {
ReleaseState::Published => "published",
ReleaseState::Withdrawn => "withdrawn",
diff --git a/src/db/settings.rs b/src/db/settings.rs
index 39190c8..452c4ff 100644
--- a/src/db/settings.rs
+++ b/src/db/settings.rs
@@ -1,6 +1,8 @@
use rusqlite::{params, OptionalExtension};
-use crate::db::{Db, Writer};
+use crate::db::Db;
+#[cfg(feature = "test-support")]
+use crate::db::Writer;
use crate::error::Result;
pub fn all_settings(db: &Db) -> Result<Vec<(String, String)>> {
diff --git a/src/db/world.rs b/src/db/world.rs
index 3a7bb9e..4bd832d 100644
--- a/src/db/world.rs
+++ b/src/db/world.rs
@@ -1,6 +1,8 @@
use rusqlite::params;
-use crate::db::{json_or, Db, WorldMember, Writer};
+#[cfg(feature = "test-support")]
+use crate::db::{json_or, Db};
+use crate::db::{WorldMember, Writer};
use crate::error::Result;
use crate::time;