Skip to content

Update to Rust 1.86 toolchain, 2024 Edition #60

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

Merged
merged 6 commits into from
May 14, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
format-code:
runs-on: "ubuntu-latest"
container: rust:1.82
container: rust:1.86

steps:
- name: Checkout the code on merge
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
lint:
runs-on: "ubuntu-latest"
container: rust:1.82
container: rust:1.86

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
features: [""]
runs-on: "ubuntu-latest"
container: rust:1.82
container: rust:1.86

steps:
- uses: actions/checkout@v2
Expand All @@ -26,7 +26,7 @@ jobs:
matrix:
features: [""]
runs-on: "ubuntu-latest"
container: rust:1.82
container: rust:1.86
services:
consul:
image: consul:1.11.11
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container: rust:1.82
container: rust:1.86
services:
consul:
image: consul:1.11.11
Expand All @@ -25,7 +25,7 @@ jobs:

dry-run:
runs-on: ubuntu-latest
container: rust:1.82
container: rust:1.86

steps:
- uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
publish:
needs: [test, dry-run]
runs-on: ubuntu-latest
container: rust:1.82
container: rust:1.86
environment: crates-publish

steps:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

## 0.11.0 - 2025-05-13
- Update Rust toolchain to 1.86
- Update crate Rust edition support to Rust 2024.

## 0.10.0 - 2025-05-13
- Supports registering multiple health checks. This breaks backward compatibility and drops supports to consul servers
older than 0.5.0 that do not have this commit: [674be58e55f](https://github.com/hashicorp/consul/commit/674be58e55f3f2b1f1c64ef2f52bfbd577db0c7c)
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "rs-consul"
# Don't forget to update the readme with the new version!
version = "0.10.0"
version = "0.11.0"
authors = ["Roblox"]
edition = "2021"
edition = "2024"
description = "This crate provides access to a set of strongly typed apis to interact with consul (https://www.consul.io/)"
readme = "README.md"
repository = "https://github.com/Roblox/rs-consul"
Expand Down
2 changes: 1 addition & 1 deletion examples/deregister_service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rs_consul::{types::*, Config, Consul};
use rs_consul::{Config, Consul, types::*};

#[tokio::main] // Enables async main
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/register_service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rs_consul::{types::*, Config, Consul};
use rs_consul::{Config, Consul, types::*};

#[tokio::main] // Enables async main
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.82
1.86
4 changes: 3 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ pub enum ConsulError {
TimeoutExceeded(std::time::Duration),

/// Unable to resolve the service's instances in Consul.
#[error("Unable to resolve service '{0}' to a concrete list of addresses and ports for its instances via consul.")]
#[error(
"Unable to resolve service '{0}' to a concrete list of addresses and ports for its instances via consul."
)]
ServiceInstanceResolutionFailed(String),

/// An error from ureq occurred.
Expand Down
2 changes: 1 addition & 1 deletion src/hyper_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ SOFTWARE.
*/
use hyper::Version;
use opentelemetry::{
KeyValue,
global::{BoxedSpan, BoxedTracer},
trace::{Span, Status, Tracer},
KeyValue,
};

/// Create an OpenTelemetry Span for the given HTTP request, according to the OpenTelemetry
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ use base64::Engine;
use http_body_util::combinators::BoxBody;
use http_body_util::{Empty, Full};
use hyper::body::Bytes;
use hyper::{body::Buf, Method};
use hyper_util::client::legacy::{connect::HttpConnector, Builder, Client};
use hyper::{Method, body::Buf};
use hyper_util::client::legacy::{Builder, Client, connect::HttpConnector};
use serde::{Deserialize, Serialize};
use slog_scope::{error, info};
use tokio::time::timeout;
Expand Down Expand Up @@ -546,7 +546,8 @@ impl Consul {
if sn.service.address.is_empty() {
info!(
"Consul service {service_name} instance had an empty Service address, with port:{port}",
service_name = &sn.service.service, port = sn.service.port
service_name = &sn.service.service,
port = sn.service.port
);
sn.node.address
} else {
Expand Down Expand Up @@ -637,7 +638,7 @@ impl Consul {
req.uri(url)
}

async fn execute_request<'a>(
async fn execute_request(
&self,
req: http::request::Builder,
body: BoxBody<Bytes, Infallible>,
Expand Down
6 changes: 3 additions & 3 deletions src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use http_body_util::combinators::BoxBody;
use hyper::body::Bytes;

use crate::{
errors::ConsulError, Consul, CreateOrUpdateKeyRequest, LockRequest, LockWatchRequest,
ReadKeyRequest, ReadKeyResponse, ResponseMeta, Result,
Consul, CreateOrUpdateKeyRequest, LockRequest, LockWatchRequest, ReadKeyRequest,
ReadKeyResponse, ResponseMeta, Result, errors::ConsulError,
};

/// Represents a lock against Consul.
Expand Down Expand Up @@ -100,7 +100,7 @@ impl Consul {
/// - request - the [LockWatchRequest](consul::types::LockWatchRequest)
/// # Errors:
/// [ConsulError](consul::ConsulError) describes all possible errors returned by this api.
pub async fn watch_lock<'a>(
pub async fn watch_lock(
&self,
request: LockWatchRequest<'_>,
) -> Result<ResponseMeta<Vec<ReadKeyResponse>>> {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{types, QueryOptions};
use crate::{QueryOptions, types};

pub(crate) fn add_query_option_params(
uri: &mut String,
Expand Down
8 changes: 5 additions & 3 deletions tests/test_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ mod tests {
"2.2.2.2".to_string(),
"3.3.3.3".to_string(),
];
assert!(expected_addresses
.iter()
.all(|item| addresses.contains(item)));
assert!(
expected_addresses
.iter()
.all(|item| addresses.contains(item))
);

let tags: Vec<String> = response
.iter()
Expand Down
Loading