From b3825e78c709ca1d26d0d3a101f5f7a50230bc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Fri, 19 Jul 2024 15:39:02 +0200 Subject: [PATCH] feat: improve cargo manifest, add ci --- .github/FUNDING.yml | 1 + .github/README | 1 + .github/workflows/check.yml | 28 ++++++++++++++++++++++++++++ Cargo.toml | 12 ++++++++++++ src/discord_presence.rs | 5 +++-- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/README create mode 100644 .github/workflows/check.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..1747602 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: xhyrom diff --git a/.github/README b/.github/README new file mode 100644 index 0000000..f6c5c48 --- /dev/null +++ b/.github/README @@ -0,0 +1 @@ +only for github mirror diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..e7e319d --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,28 @@ +name: Check +on: + push: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: install rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: cache dependencies + uses: Swatinem/rust-cache@v2 + + - name: check + run: cargo check --all + + - name: fmt + run: cargo fmt --all -- --check + + - name: clippy + run: cargo clippy --all -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 629ffdd..6f3513b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,9 @@ name = "zed-discord-presence" version = "0.1.0" edition = "2021" +license = "GNU General Public License v3.0" +license-file = "LICENSE" +repository = "https://git.sr.ht/~hyro/zed-discord-presence" [lib] path = "src/discord_presence.rs" @@ -12,3 +15,12 @@ zed_extension_api = "0.0.6" [workspace] members = ["lsp"] + +[lints] +[lints.clippy] +correctness = "deny" +suspicious = "warn" +complexity = "warn" +perf = "warn" +style = "deny" +pedantic = "warn" diff --git a/src/discord_presence.rs b/src/discord_presence.rs index be3fe88..f1ef43c 100644 --- a/src/discord_presence.rs +++ b/src/discord_presence.rs @@ -5,6 +5,7 @@ struct DiscordPresenceExtension { cached_binary_path: Option, } +#[allow(clippy::match_wildcard_for_single_variants)] impl DiscordPresenceExtension { fn language_server_binary_path( &mut self, @@ -40,7 +41,7 @@ impl DiscordPresenceExtension { arch = match arch { zed::Architecture::Aarch64 => "aarch64", zed::Architecture::X8664 => "x86_64", - _ => return Err(format!("unsupported architecture: {:?}", arch)), + _ => return Err(format!("unsupported architecture: {arch:?}")), }, os = match platform { zed::Os::Mac => "apple-darwin", @@ -57,7 +58,7 @@ impl DiscordPresenceExtension { .assets .iter() .find(|asset| asset.name == asset_name) - .ok_or_else(|| format!("no asset found matching {:?}", asset_name))?; + .ok_or_else(|| format!("no asset found matching {asset_name:?}"))?; let version_dir = format!("discord-presence-lsp-{}", release.version); let asset_name = asset_name