Improve Makefile and pint Rust to version 1.89.0
This commit is contained in:
parent
f00b86b08c
commit
79406705d8
@ -5,7 +5,7 @@ resolver = "3"
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
rust-version = "1.85.0"
|
rust-version = "1.89.0"
|
||||||
|
|
||||||
[workspace.lints.rust]
|
[workspace.lints.rust]
|
||||||
unsafe_code = "forbid"
|
unsafe_code = "forbid"
|
||||||
|
|||||||
16
Makefile
16
Makefile
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
HAS_CARGO := $(wildcard Cargo.toml)
|
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
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
@ -26,11 +32,13 @@ format-check: ## Check code formatting without applying changes
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: ## Run linters across all targets and features
|
lint: ## Run linters across every crate under crates/
|
||||||
@if [ -z "$(HAS_CARGO)" ]; then \
|
@if [ -z "$(HAS_CARGO)" ]; then \
|
||||||
echo "No Cargo.toml found. Skipping lint."; \
|
echo "No Cargo.toml found. Skipping lint."; \
|
||||||
|
elif [ -z "$(CRATES)" ]; then \
|
||||||
|
echo "No crates/*/Cargo.toml found. Skipping lint."; \
|
||||||
else \
|
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
|
fi
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
@ -52,6 +60,10 @@ clean: ## Remove build output
|
|||||||
cargo clean; \
|
cargo clean; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: shell
|
||||||
|
shell: ## Enter the Nix dev shell defined in flake.nix
|
||||||
|
@nix develop
|
||||||
|
|
||||||
.PHONY: setup-hooks
|
.PHONY: setup-hooks
|
||||||
setup-hooks: ## Install Git hooks with pre-commit
|
setup-hooks: ## Install Git hooks with pre-commit
|
||||||
@pre-commit install --hook-type pre-commit
|
@pre-commit install --hook-type pre-commit
|
||||||
|
|||||||
13
README.md
13
README.md
@ -5,16 +5,21 @@ This repo is a playground for running small experiments related to things like F
|
|||||||
### Development
|
### Development
|
||||||
|
|
||||||
```sh
|
```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
|
nix develop
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Makefile Targets
|
#### Makefile Targets
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make format
|
make format # Format Rust code
|
||||||
make lint
|
make lint # Run linter checks
|
||||||
make test
|
make test # Run tests
|
||||||
make check
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `make help` to see all the available targets.
|
Run `make help` to see all the available targets.
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
## Crates
|
## Crates
|
||||||
|
|
||||||
Independent Rust app crates live in this directory.
|
Each subdirectory should be a normal Cargo package (or crate) with its own `Cargo.toml`.
|
||||||
|
Something like this:
|
||||||
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:
|
|
||||||
|
|
||||||
```text
|
```text
|
||||||
crates/
|
crates/
|
||||||
|
|||||||
@ -4,7 +4,7 @@ This demo shows how to store and read data from Geomerge.
|
|||||||
|
|
||||||
The demo:
|
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,
|
2. creates a Geomerge store,
|
||||||
3. inserts a small graph dataset in one transaction,
|
3. inserts a small graph dataset in one transaction,
|
||||||
4. reads the inserted edge back,
|
4. reads the inserted edge back,
|
||||||
|
|||||||
@ -160,6 +160,7 @@ fn row_count(store: &Store, table: &str) -> DemoResult<usize> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
#[allow(clippy::expect_used, clippy::unwrap_used)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{add_paths_data, load_paths_theory, row_count, run_demo};
|
use super::{add_paths_data, load_paths_theory, row_count, run_demo};
|
||||||
use geomerge::{
|
use geomerge::{
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Pinned to match workspace.package.rust-version in Cargo.toml.
|
# 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" ];
|
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.85.0"
|
channel = "1.89.0"
|
||||||
components = ["rustfmt", "clippy", "rust-analyzer"]
|
components = ["rustfmt", "clippy", "rust-analyzer"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user