feat: improve cargo manifest, add ci

This commit is contained in:
Jozef Steinhübl 2024-07-19 15:39:02 +02:00
parent be343e10c6
commit b3825e78c7
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
5 changed files with 45 additions and 2 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
ko_fi: xhyrom

1
.github/README vendored Normal file
View file

@ -0,0 +1 @@
only for github mirror

28
.github/workflows/check.yml vendored Normal file
View file

@ -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

View file

@ -2,6 +2,9 @@
name = "zed-discord-presence" name = "zed-discord-presence"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
license = "GNU General Public License v3.0"
license-file = "LICENSE"
repository = "https://git.sr.ht/~hyro/zed-discord-presence"
[lib] [lib]
path = "src/discord_presence.rs" path = "src/discord_presence.rs"
@ -12,3 +15,12 @@ zed_extension_api = "0.0.6"
[workspace] [workspace]
members = ["lsp"] members = ["lsp"]
[lints]
[lints.clippy]
correctness = "deny"
suspicious = "warn"
complexity = "warn"
perf = "warn"
style = "deny"
pedantic = "warn"

View file

@ -5,6 +5,7 @@ struct DiscordPresenceExtension {
cached_binary_path: Option<String>, cached_binary_path: Option<String>,
} }
#[allow(clippy::match_wildcard_for_single_variants)]
impl DiscordPresenceExtension { impl DiscordPresenceExtension {
fn language_server_binary_path( fn language_server_binary_path(
&mut self, &mut self,
@ -40,7 +41,7 @@ impl DiscordPresenceExtension {
arch = match arch { arch = match arch {
zed::Architecture::Aarch64 => "aarch64", zed::Architecture::Aarch64 => "aarch64",
zed::Architecture::X8664 => "x86_64", zed::Architecture::X8664 => "x86_64",
_ => return Err(format!("unsupported architecture: {:?}", arch)), _ => return Err(format!("unsupported architecture: {arch:?}")),
}, },
os = match platform { os = match platform {
zed::Os::Mac => "apple-darwin", zed::Os::Mac => "apple-darwin",
@ -57,7 +58,7 @@ impl DiscordPresenceExtension {
.assets .assets
.iter() .iter()
.find(|asset| asset.name == asset_name) .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 version_dir = format!("discord-presence-lsp-{}", release.version);
let asset_name = asset_name let asset_name = asset_name