← Skills
Coding conventions and patterns for the NotAlterra project.
anyhow::Result for fallible functions - no custom error typesanyhow::bail! for early returns with context.with_context(|| format!(...)) on Result from external cratesunwrap() and expect() outside of tests and exampleslet _ = fallible_fn() when deliberately ignoring errorsstd::fs convenience functions for simple operations (fs::read(), fs::write(), fs::read_dir())PathBuf for owned paths, &Path for borrowed referencespath.exists() before operationssaturating_sub for all arithmetic that could underflowformat!() for construction, avoid + concatenationto_string_lossy() for OsStr → String conversionVec over linked lists or custom containersHashSet for deduplicationOption<T> for nullable values - never null or sentinel valuesstruct with named fields for complex return typesDebug, Clone on all data structures, Default where meaningfulAll four extractors follow the same pattern:
windows(target.len()).position()Option or Result - never panicWhen adding a new property type, follow this exact pattern and add a bounds check on every array access.
All dialogs follow the same structure:
centered_rect_size() or centered_rect()Clear widget, then a bordered Blockinner area with margindraw_whale_separator(f, bar, app) at the bottomAll menu actions:
ops::* for actual file operationsguard::log_action() with sanitized paths-D warnings enforced in CI - no exceptionscollapsible_match, manual_is_multiple_of, empty_line_after_doc_comments, needless_borrows_for_generic_argscargo audit and cargo deny before each release