Skip to content

Commit

Permalink
Update Rust toolchains to nightly-2024-10-07 (#5332)
Browse files Browse the repository at this point in the history
Co-authored-by: hash-worker[bot] <180894564+hash-worker[bot]@users.noreply.github.com>
Co-authored-by: Bilal Mahmoud <[email protected]>
  • Loading branch information
hash-worker[bot] and indietyp authored Oct 7, 2024
1 parent 784c6c9 commit a4669ac
Show file tree
Hide file tree
Showing 47 changed files with 95 additions and 81 deletions.
6 changes: 5 additions & 1 deletion apps/hash-graph/libs/api/src/rest/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ use tower_http::{
};
use tracing::field::Empty;

#[expect(
clippy::type_complexity,
reason = "factoring out the types would make the code less readable"
)]
pub fn span_trace_layer() -> TraceLayer<
SharedClassifier<ServerErrorsAsFailures>,
impl Fn(&Request<Body>) -> tracing::Span + Clone,
Expand All @@ -37,7 +41,7 @@ pub fn span_trace_layer() -> TraceLayer<
struct HeaderExtractor<'a>(&'a http::HeaderMap);
// Let OpenTelemetry pick the field names to make our headers "standardized".
// We would have to set `traceparent` in a header to correlate spans.
impl<'a> Extractor for HeaderExtractor<'a> {
impl Extractor for HeaderExtractor<'_> {
fn get(&self, key: &str) -> Option<&str> {
self.0.get(key).and_then(|value| value.to_str().ok())
}
Expand Down
12 changes: 10 additions & 2 deletions apps/hash-graph/libs/graph/src/store/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub struct ReadParameter<'f, R: QueryRecord, S> {
limit: Option<usize>,
}

impl<'f, R: QueryRecord> Default for ReadParameter<'f, R, ()> {
impl<R: QueryRecord> Default for ReadParameter<'_, R, ()> {
fn default() -> Self {
Self {
filters: None,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl<'f, R: QueryRecord> ReadParameter<'f, R, ()> {
}
}

impl<'f, R: QueryRecord, S: Sorting> ReadParameter<'f, R, S> {
impl<R: QueryRecord, S: Sorting> ReadParameter<'_, R, S> {
#[must_use]
pub const fn limit(mut self, limit: usize) -> Self {
self.limit = Some(limit);
Expand Down Expand Up @@ -155,6 +155,10 @@ pub trait ReadPaginated<R: QueryRecord, S: Sorting + Sync>: Read<R> {

type ReadPaginatedStream: Stream<Item = Result<Self::QueryResult, QueryError>> + Send + Sync;

#[expect(
clippy::type_complexity,
reason = "simplification of type would lead to more unreadable code"
)]
fn read_paginated(
&self,
filter: &Filter<'_, R>,
Expand All @@ -172,6 +176,10 @@ pub trait ReadPaginated<R: QueryRecord, S: Sorting + Sync>: Read<R> {
>,
> + Send;

#[expect(
clippy::type_complexity,
reason = "simplification of type would lead to more unreadable code"
)]
#[instrument(level = "info", skip(self, filter, sorting))]
fn read_paginated_vec(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl Transpile for Expression {
}

pub struct Transpiler<'t, T>(pub &'t T);
impl<'t, T> Display for Transpiler<'t, T>
impl<T> Display for Transpiler<'_, T>
where
T: Transpile,
{
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/libs/store/src/filter/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub enum ParameterList<'p> {
EntityEditionIds(&'p [EntityEditionId]),
}

impl<'p> Parameter<'p> {
impl Parameter<'_> {
#[must_use]
pub fn to_owned(&self) -> Parameter<'static> {
match self {
Expand Down
5 changes: 5 additions & 0 deletions libs/@local/codec/src/serde/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#![expect(
clippy::ref_option,
reason = "serde requires &Option<_> not Option<&_>"
)]

pub mod constant;
pub mod string_hash_map;

Expand Down
2 changes: 1 addition & 1 deletion libs/@local/codec/src/serde/string_hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
key: PhantomData<K>,
}

impl<'de, K> Visitor<'de> for KeySeed<K>
impl<K> Visitor<'_> for KeySeed<K>
where
K: FromStr,
K::Err: Display,
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/harpc/net/src/session/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ where

pub(crate) type ResponseWriter<'a> = PacketWriter<'a, Response>;

impl<'a> ResponseWriter<'a> {
impl ResponseWriter<'_> {
pub(crate) const fn is_error(&self) -> bool {
matches!(self.context.kind, ResponseKind::Err(_))
}
Expand Down
6 changes: 2 additions & 4 deletions libs/@local/harpc/tower/src/body/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,13 @@ pub trait BodyExt: Body {
Pin::new(self).poll_frame(cx)
}

fn frame(
&mut self,
) -> impl Future<Output = Option<Result<Frame<Self::Data, Self::Control>, Self::Error>>>
fn frame(&mut self) -> impl Future<Output = Option<BodyFrameResult<Self>>>
where
Self: Unpin,
{
struct FrameFuture<'a, T: ?Sized>(&'a mut T);

impl<'a, T: Body + Unpin + ?Sized> Future for FrameFuture<'a, T> {
impl<T: Body + Unpin + ?Sized> Future for FrameFuture<'_, T> {
type Output = Option<Result<Frame<T::Data, T::Control>, T::Error>>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Expand Down
1 change: 0 additions & 1 deletion libs/@local/harpc/tower/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
impl_trait_in_assoc_type,
never_type,
type_changing_struct_update,
control_flow_enum,
error_generic_member_access
)]
#![cfg_attr(test, feature(noop_waker, assert_matches))]
Expand Down
4 changes: 2 additions & 2 deletions libs/@local/harpc/wire-protocol/src/codec/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<'a, B> Buffer<'a, B> {
}
}

impl<'a, B> Buffer<'a, B>
impl<B> Buffer<'_, B>
where
B: Buf,
{
Expand Down Expand Up @@ -127,7 +127,7 @@ where
}
}

impl<'a, B> Buffer<'a, B>
impl<B> Buffer<'_, B>
where
B: BufMut,
{
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hql/cst/src/expr/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Display for Path<'_> {
}
}

impl<'arena, 'source> From<Path<'arena>> for ExprKind<'arena, 'source> {
impl<'arena> From<Path<'arena>> for ExprKind<'arena, '_> {
fn from(path: Path<'arena>) -> Self {
Self::Path(path)
}
Expand Down
16 changes: 8 additions & 8 deletions libs/@local/hql/cst/src/expr/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Spanned for Signature<'_> {
}
}

impl<'a> Display for Signature<'a> {
impl Display for Signature<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
if !self.generics.is_empty() {
fmt.write_char('<')?;
Expand Down Expand Up @@ -78,7 +78,7 @@ impl<'a> Display for Signature<'a> {
}
}

impl<'arena, 'source> From<Signature<'arena>> for ExprKind<'arena, 'source> {
impl<'arena> From<Signature<'arena>> for ExprKind<'arena, '_> {
fn from(signature: Signature<'arena>) -> Self {
Self::Signature(signature)
}
Expand All @@ -92,13 +92,13 @@ pub struct Generic<'arena> {
pub span: SpanId,
}

impl<'arena> Spanned for Generic<'arena> {
impl Spanned for Generic<'_> {
fn span(&self) -> SpanId {
self.span
}
}

impl<'a> Display for Generic<'a> {
impl Display for Generic<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
Display::fmt(&self.name, fmt)?;

Expand All @@ -119,13 +119,13 @@ pub struct Argument<'arena> {
pub span: SpanId,
}

impl<'arena> Spanned for Argument<'arena> {
impl Spanned for Argument<'_> {
fn span(&self) -> SpanId {
self.span
}
}

impl<'arena> Display for Argument<'arena> {
impl Display for Argument<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
Display::fmt(&self.name, fmt)?;
fmt.write_str(": ")?;
Expand All @@ -140,13 +140,13 @@ pub struct Return<'arena> {
pub span: SpanId,
}

impl<'arena> Spanned for Return<'arena> {
impl Spanned for Return<'_> {
fn span(&self) -> SpanId {
self.span
}
}

impl<'arena> Display for Return<'arena> {
impl Display for Return<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
Display::fmt(&self.r#type, fmt)
}
Expand Down
6 changes: 3 additions & 3 deletions libs/@local/hql/cst/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub struct ObjectKey<'source> {
pub value: Cow<'source, str>,
}

impl<'source> PartialEq for ObjectKey<'source> {
impl PartialEq for ObjectKey<'_> {
fn eq(&self, other: &Self) -> bool {
self.value == other.value
}
}

impl<'source> Eq for ObjectKey<'source> {}
impl Eq for ObjectKey<'_> {}

impl<'source> Hash for ObjectKey<'source> {
impl Hash for ObjectKey<'_> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.value.hash(state);
}
Expand Down
4 changes: 2 additions & 2 deletions libs/@local/hql/diagnostics/src/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl Category<'_> {
pub fn canonical_id(&self) -> impl Display + '_ {
struct DisplayCategoryId<'a, 'b>(&'a Category<'b>);

impl<'a, 'b> Display for DisplayCategoryId<'a, 'b> {
impl Display for DisplayCategoryId<'_, '_> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if let Some(parent) = &self.0.parent {
DisplayCategoryId(parent.as_ref()).fmt(fmt)?;
Expand All @@ -34,7 +34,7 @@ impl Category<'_> {
pub fn canonical_name(&self) -> impl Display + '_ {
struct DisplayCategoryName<'a, 'b>(&'a Category<'b>);

impl<'a, 'b> Display for DisplayCategoryName<'a, 'b> {
impl Display for DisplayCategoryName<'_, '_> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
if let Some(parent) = &self.0.parent {
DisplayCategoryName(parent.as_ref()).fmt(fmt)?;
Expand Down
12 changes: 6 additions & 6 deletions libs/@local/hql/diagnostics/src/rob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum RefOrBox<'a, T: ?Sized> {
Box(Box<T>),
}

impl<'a, T: ?Sized> RefOrBox<'a, T> {
impl<T: ?Sized> RefOrBox<'_, T> {
#[must_use]
pub fn into_owned(self) -> T
where
Expand All @@ -26,7 +26,7 @@ impl<'a, T: ?Sized> RefOrBox<'a, T> {
}
}

impl<'a, T> AsRef<T> for RefOrBox<'a, T> {
impl<T> AsRef<T> for RefOrBox<'_, T> {
fn as_ref(&self) -> &T {
match self {
Self::Ref(reference) => reference,
Expand All @@ -35,7 +35,7 @@ impl<'a, T> AsRef<T> for RefOrBox<'a, T> {
}
}

impl<'a, T> Clone for RefOrBox<'a, T>
impl<T> Clone for RefOrBox<'_, T>
where
T: Clone,
{
Expand All @@ -55,7 +55,7 @@ where
}
}

impl<'a, T: Display + ?Sized> Display for RefOrBox<'a, T> {
impl<T: Display + ?Sized> Display for RefOrBox<'_, T> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Ref(reference) => reference.fmt(fmt),
Expand All @@ -77,7 +77,7 @@ impl<T> From<T> for RefOrBox<'_, T> {
}

#[cfg(feature = "serde")]
impl<'a, T> serde::Serialize for RefOrBox<'a, T>
impl<T> serde::Serialize for RefOrBox<'_, T>
where
T: serde::Serialize,
{
Expand All @@ -93,7 +93,7 @@ where
}

#[cfg(feature = "serde")]
impl<'a, 'de, T> serde::Deserialize<'de> for RefOrBox<'a, T>
impl<'de, T> serde::Deserialize<'de> for RefOrBox<'_, T>
where
T: serde::Deserialize<'de>,
{
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hql/syntax-jexpr/src/lexer/token_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) enum TokenKind<'source> {
String(Cow<'source, str>),
}

impl<'source> TokenKind<'source> {
impl TokenKind<'_> {
pub(crate) fn syntax(&self) -> SyntaxKind {
SyntaxKind::from(self)
}
Expand Down
2 changes: 1 addition & 1 deletion libs/@local/hql/syntax-jexpr/src/parser/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) struct TokenStream<'arena, 'source> {
pub stack: Option<Vec<jsonptr::Token<'static>>>,
}

impl<'arena, 'source> TokenStream<'arena, 'source> {
impl<'source> TokenStream<'_, 'source> {
pub(crate) fn next_or_err(&mut self) -> Result<Token<'source>, Diagnostic<'static, SpanId>> {
let Some(token) = self.lexer.advance() else {
let span = Span {
Expand Down
4 changes: 2 additions & 2 deletions libs/@local/status/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ where
}

#[must_use]
pub const fn message(&self) -> &Option<String> {
&self.message
pub fn message(&self) -> Option<&str> {
self.message.as_deref()
}

#[must_use]
Expand Down
2 changes: 1 addition & 1 deletion libs/antsi/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-09-30"
channel = "nightly-2024-10-07"
components = ['rustfmt', 'clippy', 'llvm-tools-preview', 'rust-analyzer', 'rustc-codegen-cranelift-preview']
2 changes: 1 addition & 1 deletion libs/deer/desert/src/deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct Deserializer<'a, 'de> {
tape: Tape<'de>,
}

impl<'a, 'de> deer::Deserializer<'de> for &mut Deserializer<'a, 'de> {
impl<'de> deer::Deserializer<'de> for &mut Deserializer<'_, 'de> {
forward!(
deserialize_null,
deserialize_bool,
Expand Down
2 changes: 1 addition & 1 deletion libs/deer/desert/src/tape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(crate) struct Tape<'de> {
trivia: Trivia,
}

impl<'de> Tape<'de> {
impl Tape<'_> {
// also includes trivia
fn peek_all_n(&self, n: usize) -> Option<Token> {
self.tokens.get(n).cloned()
Expand Down
2 changes: 1 addition & 1 deletion libs/deer/json/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Reflection for AnyArray {
}
}

impl<'a> ValueToken<'a> {
impl ValueToken<'_> {
pub(crate) fn schema(&self) -> Document {
match self {
Self::Null => <() as Deserialize>::reflection(),
Expand Down
2 changes: 1 addition & 1 deletion libs/deer/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-09-30"
channel = "nightly-2024-10-07"
components = ['rustfmt', 'clippy', 'llvm-tools-preview', 'miri', 'rust-analyzer', 'rustc-codegen-cranelift-preview']
4 changes: 2 additions & 2 deletions libs/deer/src/error/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct Message<'a, 'b, E: Variant> {
properties: &'b <E::Properties as ErrorProperties>::Value<'a>,
}

impl<'a, 'b, E: Variant> Display for Message<'a, 'b, E> {
impl<E: Variant> Display for Message<'_, '_, E> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.context.message(fmt, self.properties)
}
Expand All @@ -45,7 +45,7 @@ impl<'a, E: Variant> SerializeErrorProperties<'a, E> {
}
}

impl<'a, E: Variant> Serialize for SerializeErrorProperties<'a, E> {
impl<E: Variant> Serialize for SerializeErrorProperties<'_, E> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
Loading

0 comments on commit a4669ac

Please sign in to comment.