Development guidelines for the rust-skiplist crate, including testing, module imports, formatting, and error handling conventions.
Guidelines for developing and maintaining the rust-skiplist crate, a skiplist data structure implementation in Rust.
This skill provides coding conventions and best practices specific to the rust-skiplist project. Follow these guidelines to maintain consistency and quality across the codebase.
When working on the rust-skiplist crate, adhere to these conventions:
Always run tests using `cargo nextest run` instead of the standard `cargo test`. This ensures consistency with the project's CI/CD pipeline and testing infrastructure.
```bash
cargo nextest run
```
When referencing modules within the same crate, prefer absolute paths from the crate root over relative paths:
This makes refactoring easier and improves code clarity by showing the full path from the crate root.
Format all code using the nightly Rust formatter:
```bash
cargo +nightly fmt
```
Run this command before committing changes to ensure consistent code style across the project.
Minimize the introduction of panics in the codebase. When a panic is unavoidable:
The descriptive message in `expect` helps with debugging by explaining why the operation should succeed.
**Good module import:**
```rust
use crate::node::Node;
use crate::skiplist::SkipList;
```
**Good error handling:**
```rust
let value = map.get(&key).expect("key must exist after insertion");
```
**Bad practices to avoid:**
```rust
// Avoid relative imports
use super::super::node::Node;
// Avoid unwrap without context
let value = map.get(&key).unwrap();
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/rust-skiplist-development-g4b54n/raw