Improve Makefile and pint Rust to version 1.89.0

This commit is contained in:
Hassan Abedi 2026-05-29 15:22:47 +02:00
parent f00b86b08c
commit 79406705d8
8 changed files with 30 additions and 16 deletions

View File

@ -5,7 +5,7 @@ resolver = "3"
[workspace.package]
edition = "2024"
license = "MIT OR Apache-2.0"
rust-version = "1.85.0"
rust-version = "1.89.0"
[workspace.lints.rust]
unsafe_code = "forbid"

View File

@ -2,6 +2,12 @@
HAS_CARGO := $(wildcard Cargo.toml)
# Workspace crates discovered under `crates/*/Cargo.toml`. The directory name is
# assumed to match the package name (the convention documented in crates/README.md).
CRATE_MANIFESTS := $(wildcard crates/*/Cargo.toml)
CRATES := $(patsubst crates/%/Cargo.toml,%,$(CRATE_MANIFESTS))
CRATE_FLAGS := $(addprefix -p ,$(CRATES))
.DEFAULT_GOAL := help
.PHONY: help
@ -26,11 +32,13 @@ format-check: ## Check code formatting without applying changes
fi
.PHONY: lint
lint: ## Run linters across all targets and features
lint: ## Run linters across every crate under crates/
@if [ -z "$(HAS_CARGO)" ]; then \
echo "No Cargo.toml found. Skipping lint."; \
elif [ -z "$(CRATES)" ]; then \
echo "No crates/*/Cargo.toml found. Skipping lint."; \
else \
cargo clippy --all-targets --all-features -- -D warnings; \
cargo clippy $(CRATE_FLAGS) --no-deps -- -D warnings -D clippy::unwrap_used -D clippy::expect_used; \
fi
.PHONY: test
@ -52,6 +60,10 @@ clean: ## Remove build output
cargo clean; \
fi
.PHONY: shell
shell: ## Enter the Nix dev shell defined in flake.nix
@nix develop
.PHONY: setup-hooks
setup-hooks: ## Install Git hooks with pre-commit
@pre-commit install --hook-type pre-commit

View File

@ -5,16 +5,21 @@ This repo is a playground for running small experiments related to things like F
### Development
```sh
# Clone the repo with submodules
git clone --recursive git@code.obsidian.systems:habedi-work/storage-engine-playground.git
```
```sh
# Enter the development environment
nix develop
```
#### Makefile Targets
```sh
make format
make lint
make test
make check
make format # Format Rust code
make lint # Run linter checks
make test # Run tests
```
Run `make help` to see all the available targets.

View File

@ -1,11 +1,7 @@
## Crates
Independent Rust app crates live in this directory.
Each subdirectory should be a normal Cargo package with its own `Cargo.toml`.
The repository root is a virtual workspace, so shared commands such as `make format`, `make lint`, and `make test` run across all crates.
Suggested shape:
Each subdirectory should be a normal Cargo package (or crate) with its own `Cargo.toml`.
Something like this:
```text
crates/

View File

@ -4,7 +4,7 @@ This demo shows how to store and read data from Geomerge.
The demo:
1. loads the compiled `paths.json` schema,
1. loads the compiled [`paths.json`](../../external/geomerge/crates/geomerge/tests/data/paths.json) schema,
2. creates a Geomerge store,
3. inserts a small graph dataset in one transaction,
4. reads the inserted edge back,

View File

@ -160,6 +160,7 @@ fn row_count(store: &Store, table: &str) -> DemoResult<usize> {
}
#[cfg(test)]
#[allow(clippy::expect_used, clippy::unwrap_used)]
mod tests {
use super::{add_paths_data, load_paths_theory, row_count, run_demo};
use geomerge::{

View File

@ -19,7 +19,7 @@
};
# Pinned to match workspace.package.rust-version in Cargo.toml.
rustToolchain = pkgs.rust-bin.stable."1.85.0".default.override {
rustToolchain = pkgs.rust-bin.stable."1.89.0".default.override {
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
};
in

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "1.85.0"
channel = "1.89.0"
components = ["rustfmt", "clippy", "rust-analyzer"]