Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change minimum Rust version to 1.64.0 #395

Merged
merged 4 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust-version: [1.59.0, beta, nightly]
rust-version: [1.64.0, beta, nightly]
runtime: [runtime-tokio, runtime-agnostic]
include:
- rust-version: nightly
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- uses: actions/checkout@v3
- id: install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.59.0
uses: dtolnay/rust-toolchain@1.64.0
with:
components: clippy
- name: Run cargo clippy
Expand All @@ -67,7 +67,7 @@ jobs:
- uses: actions/checkout@v3
- id: install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.59.0
uses: dtolnay/rust-toolchain@1.64.0
with:
components: rustfmt
- name: Run cargo fmt
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tower-lsp"
version = "0.19.0"
authors = ["Eyal Kalderon <[email protected]>"]
edition = "2021"
rust-version = "1.59.0"
rust-version = "1.64.0"
description = "Language Server Protocol implementation based on Tower"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/ebkalderon/tower-lsp"
Expand Down Expand Up @@ -39,11 +39,11 @@ tower = { version = "0.4", default-features = false, features = ["util"] }
tracing = "0.1"

[dev-dependencies]
async-tungstenite = { version = "0.18", features = ["tokio-runtime"] }
async-tungstenite = { version = "0.22", features = ["tokio-runtime"] }
tracing-subscriber = "0.3"
tokio = { version = "1.17", features = ["io-util", "io-std", "macros", "rt-multi-thread"] }
tokio-util = { version = "0.7", features = ["compat"] }
ws_stream_tungstenite = { version = "0.9", features = ["tokio_io"] }
ws_stream_tungstenite = { version = "0.10", features = ["tokio_io"] }

[workspace]
members = [".", "./tower-lsp-macros"]
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.59.0
1.64.0
2 changes: 1 addition & 1 deletion src/jsonrpc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl Display for ErrorCode {
}

/// A JSON-RPC error object.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Error {
/// A number indicating the error type that occurred.
Expand Down
2 changes: 1 addition & 1 deletion src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod pending;
mod state;

/// Error that occurs when attempting to call the language server after it has already exited.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ExitedError(());

impl std::error::Error for ExitedError {}
Expand Down
2 changes: 1 addition & 1 deletion src/service/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Formatter};
use std::sync::atomic::{AtomicU8, Ordering};

/// A list of possible states the language server can be in.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum State {
/// Server has not received an `initialize` request.
Expand Down
35 changes: 17 additions & 18 deletions tower-lsp-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use syn::{parse_macro_input, FnArg, ItemTrait, LitStr, ReturnType, TraitItem};
/// as RPC handlers.
#[proc_macro_attribute]
pub fn rpc(attr: TokenStream, item: TokenStream) -> TokenStream {
// It will be checked later in `parse_method_calls()`.
// Attribute will be parsed later in `parse_method_calls()`.
if !attr.is_empty() {
return item;
}
Expand Down Expand Up @@ -48,24 +48,23 @@ fn parse_method_calls(lang_server_trait: &ItemTrait) -> Vec<MethodCall> {
_ => continue,
};

let mut rpc_name: Option<String> = None;

for attr in &method.attrs {
if attr.meta.path().is_ident("rpc") {
attr.parse_nested_meta(|meta| {
if meta.path.is_ident("name") {
let s: LitStr = meta.value()?.parse()?;
rpc_name = Some(s.value());
Ok(())
} else {
Err(meta.error("expected `name`"))
}
})
.unwrap();
let attr = method
.attrs
.iter()
.find(|attr| attr.meta.path().is_ident("rpc"))
.expect("expected `#[rpc(name = \"foo\")]` attribute");

let mut rpc_name = String::new();
attr.parse_nested_meta(|meta| {
if meta.path.is_ident("name") {
let s: LitStr = meta.value().and_then(|v| v.parse())?;
rpc_name = s.value();
Ok(())
} else {
Err(meta.error("expected `name` identifier in `#[rpc]`"))
}
}

let rpc_name = rpc_name.expect("expected `#[rpc(name = \"foo\")]` attribute");
})
.unwrap();

let params = method.sig.inputs.iter().nth(1).and_then(|arg| match arg {
FnArg::Typed(pat) => Some(&*pat.ty),
Expand Down
Loading