Skip to content

Commit cc911a3

Browse files
meskilltusharmath
andauthored
chore: update rust version (#3043)
Co-authored-by: Tushar Mathur <[email protected]>
1 parent d63b288 commit cc911a3

26 files changed

+40
-44
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ jobs:
7575
with:
7676
target: wasm32-unknown-unknown
7777

78+
- name: Install Node.js
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: "20.11.0"
82+
7883
- name: Install Wasm Pack
7984
run: cargo install wasm-bindgen-cli --vers "0.2.92"
8085

.nightly/rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-06-01"
2+
channel = "nightly-2024-10-20"
33
profile = "default"

benches/request_template_bench.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl PathValue for Context {
3333
}
3434

3535
impl PathString for Context {
36-
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'_, str>> {
36+
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'a, str>> {
3737
self.value.path_string(parts)
3838
}
3939
}

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.80"
2+
channel = "1.82"
33
profile = "default"

src/cli/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl Fmt {
99
format!("{}", heading.bold())
1010
}
1111

12-
pub fn meta(meta: &String) -> String {
12+
pub fn meta(meta: &str) -> String {
1313
format!("{}", meta.yellow())
1414
}
1515

src/core/async_graphql_hyper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl GraphQLArcResponse {
397397
.collect::<Vec<u8>>();
398398

399399
// Wrap the result in square brackets
400-
[&[b'['], &combined[..], &[b']']].concat()
400+
[b"[", &combined[..], b"]"].concat()
401401
}
402402
JITBatchResponse::Single(resp) => resp.body.as_ref().to_owned(),
403403
};

src/core/blueprint/definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ pub fn to_field_definition(
496496
object_name: &str,
497497
config_module: &ConfigModule,
498498
type_of: &config::Type,
499-
name: &String,
499+
name: &str,
500500
) -> Valid<FieldDefinition, String> {
501501
update_args()
502502
.and(update_http().trace(config::Http::trace_name().as_str()))

src/core/config/npo/tracker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a> From<Chunk<Chunk<FieldName<'a>>>> for QueryPath<'a> {
3333
}
3434
}
3535

36-
impl<'a> Display for QueryPath<'a> {
36+
impl Display for QueryPath<'_> {
3737
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
3838
let query_data: Vec<String> = self
3939
.0
@@ -109,7 +109,7 @@ pub struct PathTracker<'a> {
109109
}
110110

111111
impl<'a> PathTracker<'a> {
112-
pub fn new(config: &'a Config) -> PathTracker {
112+
pub fn new(config: &'a Config) -> PathTracker<'a> {
113113
PathTracker { config, cache: Default::default() }
114114
}
115115

src/core/config/reader_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct ConfigReaderContext<'a> {
1313
pub headers: HeaderMap,
1414
}
1515

16-
impl<'a> PathString for ConfigReaderContext<'a> {
16+
impl PathString for ConfigReaderContext<'_> {
1717
fn path_string<T: AsRef<str>>(&self, path: &[T]) -> Option<Cow<'_, str>> {
1818
if path.is_empty() {
1919
return None;

src/core/config/transformer/merge_types/similarity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct SimilarityTypeInfo<'a> {
2121
}
2222

2323
impl<'a> Similarity<'a> {
24-
pub fn new(config: &'a Config) -> Similarity {
24+
pub fn new(config: &'a Config) -> Similarity<'a> {
2525
Similarity { config, type_similarity_cache: PairMap::default() }
2626
}
2727

src/core/generator/generator.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct Generator {
2727
transformers: Vec<Box<dyn Transform<Value = Config, Error = String>>>,
2828
}
2929

30+
#[allow(clippy::large_enum_variant)]
3031
#[derive(Clone)]
3132
pub enum Input {
3233
Json {

src/core/grpc/request_template.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ mod tests {
204204
}
205205

206206
impl crate::core::path::PathString for Context {
207-
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'_, str>> {
207+
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'a, str>> {
208208
self.value.path_string(parts)
209209
}
210210
}

src/core/has_headers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub trait HasHeaders {
66
fn headers(&self) -> &HeaderMap;
77
}
88

9-
impl<'a, Ctx: ResolverContextLike> HasHeaders for EvalContext<'a, Ctx> {
9+
impl<Ctx: ResolverContextLike> HasHeaders for EvalContext<'_, Ctx> {
1010
fn headers(&self) -> &HeaderMap {
1111
self.headers()
1212
}

src/core/http/request_template.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ impl<Ctx: PathString + HasHeaders + PathValue> CacheKey<Ctx> for RequestTemplate
277277

278278
/// ValueStringEval parses the mustache template and uses ctx to retrieve the
279279
/// values for templates.
280-
281280
struct ValueStringEval<A>(std::marker::PhantomData<A>);
282281
impl<A> Default for ValueStringEval<A> {
283282
fn default() -> Self {
@@ -344,7 +343,7 @@ mod tests {
344343
}
345344

346345
impl crate::core::path::PathString for Context {
347-
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'_, str>> {
346+
fn path_string<'a, T: AsRef<str>>(&'a self, parts: &'a [T]) -> Option<Cow<'a, str>> {
348347
self.value.path_string(parts)
349348
}
350349
}

src/core/ir/eval.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,12 @@ use super::{Error, EvalContext, ResolverContextLike, TypedValue};
1212
use crate::core::json::{JsonLike, JsonObjectLike};
1313
use crate::core::serde_value_ext::ValueExt;
1414

15-
// Fake trait to capture proper lifetimes.
16-
// see discussion https://users.rust-lang.org/t/rpitit-allows-more-flexible-code-in-comparison-with-raw-rpit-in-inherit-impl/113417
17-
// TODO: could be removed after migrating to 2024 edition
18-
pub trait Captures<T: ?Sized> {}
19-
impl<T: ?Sized, U: ?Sized> Captures<T> for U {}
20-
2115
impl IR {
2216
#[tracing::instrument(skip_all, fields(otel.name = %self), err)]
2317
pub fn eval<'a, 'b, Ctx>(
2418
&'a self,
2519
ctx: &'b mut EvalContext<'a, Ctx>,
26-
) -> impl Future<Output = Result<ConstValue, Error>> + Send + Captures<&'b &'a ()>
20+
) -> impl Future<Output = Result<ConstValue, Error>> + Send + use<'a, 'b, Ctx>
2721
where
2822
Ctx: ResolverContextLike + Sync,
2923
{

src/core/ir/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, Ctx: ResolverContextLike> EvalContext<'a, Ctx> {
108108
}
109109
}
110110

111-
impl<'a, Ctx: ResolverContextLike> GraphQLOperationContext for EvalContext<'a, Ctx> {
111+
impl<Ctx: ResolverContextLike> GraphQLOperationContext for EvalContext<'_, Ctx> {
112112
fn directives(&self) -> Option<String> {
113113
let selection_field = self.graphql_ctx.field()?;
114114
selection_field

src/core/ir/resolver_context_like.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a> From<async_graphql::dynamic::ResolverContext<'a>> for ResolverContext<'
4747
}
4848
}
4949

50-
impl<'a> ResolverContextLike for ResolverContext<'a> {
50+
impl ResolverContextLike for ResolverContext<'_> {
5151
fn value(&self) -> Option<&Value> {
5252
self.inner.parent_value.as_value()
5353
}

src/core/jit/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, Input: Clone, Output> Context<'a, Input, Output> {
8585
}
8686
}
8787

88-
impl<'a> ResolverContextLike for Context<'a, ConstValue, ConstValue> {
88+
impl ResolverContextLike for Context<'_, ConstValue, ConstValue> {
8989
fn value(&self) -> Option<&ConstValue> {
9090
self.value
9191
}

src/core/jit/fixtures/jp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'a, Value: Deserialize<'a> + Clone + 'a + JsonLike<'a> + std::fmt::Debug> J
115115
JP { test_data, plan, vars }
116116
}
117117

118-
pub fn synth(&'a self) -> Synth<Value> {
118+
pub fn synth(&'a self) -> Synth<'a, Value> {
119119
let ProcessedTestData { posts, users } = self.test_data.to_processed();
120120
let vars = self.vars.clone();
121121

src/core/jit/transform/skip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<'a, Var, Value> Skip<'a, Var, Value> {
1616
}
1717
}
1818

19-
impl<'a, Var, Value: Clone> Transform for Skip<'a, Var, Value>
19+
impl<Var, Value: Clone> Transform for Skip<'_, Var, Value>
2020
where
2121
Var: for<'b> JsonLike<'b> + Clone,
2222
{

src/core/json/borrow.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'ctx> JsonLike<'ctx> for Value<'ctx> {
108108
self.is_null()
109109
}
110110

111-
fn get_path<T: AsRef<str>>(&'ctx self, path: &[T]) -> Option<&Self> {
111+
fn get_path<T: AsRef<str>>(&'ctx self, path: &[T]) -> Option<&'ctx Self> {
112112
let mut val = self;
113113
for token in path {
114114
val = match val {
@@ -123,14 +123,14 @@ impl<'ctx> JsonLike<'ctx> for Value<'ctx> {
123123
Some(val)
124124
}
125125

126-
fn get_key(&'ctx self, path: &str) -> Option<&Self> {
126+
fn get_key(&'ctx self, path: &str) -> Option<&'ctx Self> {
127127
match self {
128128
Value::Object(map) => map.get(path),
129129
_ => None,
130130
}
131131
}
132132

133-
fn group_by(&'ctx self, path: &[String]) -> std::collections::HashMap<String, Vec<&Self>> {
133+
fn group_by(&'ctx self, path: &[String]) -> std::collections::HashMap<String, Vec<&'ctx Self>> {
134134
let src = gather_path_matches(self, path, vec![]);
135135
group_by_key(src)
136136
}

src/core/json/json_like.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ pub trait JsonLike<'json>: Sized {
2727
fn as_f64(&self) -> Option<f64>;
2828
fn as_bool(&self) -> Option<bool>;
2929
fn is_null(&self) -> bool;
30-
fn get_path<T: AsRef<str>>(&'json self, path: &[T]) -> Option<&Self>;
31-
fn get_key(&'json self, path: &str) -> Option<&Self>;
32-
fn group_by(&'json self, path: &[String]) -> HashMap<String, Vec<&Self>>;
30+
fn get_path<T: AsRef<str>>(&'json self, path: &[T]) -> Option<&'json Self>;
31+
fn get_key(&'json self, path: &str) -> Option<&'json Self>;
32+
fn group_by(&'json self, path: &[String]) -> HashMap<String, Vec<&'json Self>>;
3333
}
3434

3535
/// A trait for objects that can be used as JSON objects

src/core/mustache/eval.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<A> PathStringEval<A> {
1616
}
1717
}
1818

19-
impl<'a, A: PathString> Eval<'a> for PathStringEval<A> {
19+
impl<A: PathString> Eval<'_> for PathStringEval<A> {
2020
type In = A;
2121
type Out = String;
2222

@@ -78,7 +78,7 @@ impl<A> PathGraphqlEval<A> {
7878
}
7979
}
8080

81-
impl<'a, A: PathGraphql> Eval<'a> for PathGraphqlEval<A> {
81+
impl<A: PathGraphql> Eval<'_> for PathGraphqlEval<A> {
8282
type In = A;
8383
type Out = String;
8484

src/core/path.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
//! The path module provides a trait for accessing values from a JSON-like
2+
//! structure.
13
use std::borrow::Cow;
24

35
use serde_json::json;
46

57
use crate::core::ir::{EvalContext, ResolverContextLike};
68
use crate::core::json::JsonLike;
79

8-
///
9-
/// The path module provides a trait for accessing values from a JSON-like
10-
/// structure.
11-
1210
///
1311
/// The PathString trait provides a method for accessing values from a JSON-like
1412
/// structure. The returned value is encoded as a plain string.
@@ -66,7 +64,7 @@ pub enum ValueString<'a> {
6664
String(Cow<'a, str>),
6765
}
6866

69-
impl<'a, Ctx: ResolverContextLike> EvalContext<'a, Ctx> {
67+
impl<Ctx: ResolverContextLike> EvalContext<'_, Ctx> {
7068
fn to_raw_value<T: AsRef<str>>(&self, path: &[T]) -> Option<ValueString<'_>> {
7169
let ctx = self;
7270

@@ -101,13 +99,13 @@ impl<'a, Ctx: ResolverContextLike> EvalContext<'a, Ctx> {
10199
}
102100
}
103101

104-
impl<'a, Ctx: ResolverContextLike> PathValue for EvalContext<'a, Ctx> {
102+
impl<Ctx: ResolverContextLike> PathValue for EvalContext<'_, Ctx> {
105103
fn raw_value<'b, T: AsRef<str>>(&'b self, path: &[T]) -> Option<ValueString<'b>> {
106104
self.to_raw_value(path)
107105
}
108106
}
109107

110-
impl<'a, Ctx: ResolverContextLike> PathString for EvalContext<'a, Ctx> {
108+
impl<Ctx: ResolverContextLike> PathString for EvalContext<'_, Ctx> {
111109
fn path_string<T: AsRef<str>>(&self, path: &[T]) -> Option<Cow<'_, str>> {
112110
self.to_raw_value(path).and_then(|value| match value {
113111
ValueString::String(env) => Some(env),
@@ -116,7 +114,7 @@ impl<'a, Ctx: ResolverContextLike> PathString for EvalContext<'a, Ctx> {
116114
}
117115
}
118116

119-
impl<'a, Ctx: ResolverContextLike> PathGraphql for EvalContext<'a, Ctx> {
117+
impl<Ctx: ResolverContextLike> PathGraphql for EvalContext<'_, Ctx> {
120118
fn path_graphql<T: AsRef<str>>(&self, path: &[T]) -> Option<String> {
121119
if path.len() < 2 {
122120
return None;

src/core/rest/endpoint.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub struct Endpoint {
2929
}
3030

3131
/// Creates a Rest instance from @rest directive
32-
3332
impl Endpoint {
3433
pub fn get_method(&self) -> &Method {
3534
&self.method

src/core/tracing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const INFO_STR: &str = "INFO";
2727
const WARN_STR: &str = "WARN";
2828
const ERROR_STR: &str = "ERROR";
2929

30-
impl<'a> fmt::Display for FmtLevel<'a> {
30+
impl fmt::Display for FmtLevel<'_> {
3131
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3232
if self.ansi {
3333
match *self.level {

0 commit comments

Comments
 (0)