diff --git a/.gitea/workflows/rust.yml b/.gitea/workflows/rust.yml new file mode 100644 index 0000000..64ac40a --- /dev/null +++ b/.gitea/workflows/rust.yml @@ -0,0 +1,19 @@ +on: [push, pull_request] +name: Rust Checks + +jobs: + checks: + runs-on: main + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Use cache + run: mkdir -p /cache/${{ gitea.repository }} && ln -s /cache/${{ gitea.repository }} target + - name: Cargo fmt + run: cargo fmt --check + - name: Cargo build + run: cargo build + - name: Cargo test + run: cargo test + - name: Cargo clippy + run: cargo clippy -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 78964fd..017e842 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,15 @@ keywords = ["bevy", "network", "game"] categories = ["network-programming", "game-development"] repository = "https://git.tipragot.fr/tipragot/bevnet" +[lints.rust] +missing_docs = "warn" + +[lints.clippy] +missing_docs_in_private_items = "warn" +unwrap_in_result = "warn" +unwrap_used = "warn" +nursery = "warn" + [dependencies] serde = { version = "1.0.160", features = ["derive"] } bincode = "1.3.3" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..7bbd24c --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,18 @@ +use_try_shorthand = true +use_field_init_shorthand = true + +version = "Two" +error_on_line_overflow = true +error_on_unformatted = true + +format_code_in_doc_comments = true +format_macro_bodies = true +format_macro_matchers = true +format_strings = true + +imports_granularity = "Module" +group_imports = "StdExternalCrate" + +normalize_doc_attributes = true +normalize_comments = true +wrap_comments = true