M0.2: workspace lints and lints self-test

Denies unwrap/expect/panic/unreachable/todo/unimplemented, indexing and
string slicing, missing docs and unsafe code outside tests. clippy.toml
allows them in tests. cargo xtask lints-selftest proves both directions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-13 20:28:04 +02:00
parent b10a2a72f9
commit ec1c72d9ac
7 changed files with 397 additions and 3 deletions

19
xtask/src/util.rs Normal file
View file

@ -0,0 +1,19 @@
//! Shared helpers for xtask subcommands: locating the repository, running
//! child processes and listing the files that belong to the repository.
use std::path::{Path, PathBuf};
/// Result type of every xtask step; the error is a message for the console.
pub type TaskResult<T = ()> = Result<T, String>;
/// Returns the repository root, the parent of the `xtask` crate directory.
///
/// # Errors
/// Fails if the manifest directory has no parent, which only happens when the
/// crate was moved out of the workspace.
pub fn repo_root() -> TaskResult<PathBuf> {
Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.map(Path::to_path_buf)
.ok_or_else(|| "xtask is not inside the workspace".to_string())
}