Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ allow-expect-in-tests = true
allow-print-in-tests = true
suppress-restriction-lint-in-const = true
doc-valid-idents = ["SpiceDB", "OpenAPI", ".."]
allow-renamed-params-for = ["core::fmt::Debug", "core::fmt::Display", "futures_sink::Sink", ".."]
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on accounts.
#![expect(clippy::str_to_string)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is because of rust-lang/rust-clippy#12780?


use std::sync::Arc;

use authorization::{
Expand Down
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/data_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on Data Types.

#![expect(clippy::str_to_string)]

use std::sync::Arc;

use authorization::{
Expand Down
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/entity.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on entities.

#![expect(clippy::str_to_string)]

use std::sync::Arc;

use authorization::{
Expand Down
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/entity_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on Entity types.

#![expect(clippy::str_to_string)]

use std::{collections::hash_map, sync::Arc};

use authorization::{
Expand Down
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/property_type.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on Property types.

#![expect(clippy::str_to_string)]

use std::sync::Arc;

use authorization::{
Expand Down
2 changes: 0 additions & 2 deletions apps/hash-graph/libs/api/src/rest/web.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Web routes for CRU operations on webs.

#![expect(clippy::str_to_string)]

use std::sync::Arc;

use authorization::{
Expand Down
1 change: 0 additions & 1 deletion apps/hash-graph/libs/graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#![expect(
unreachable_pub,
clippy::significant_drop_tightening,
clippy::significant_drop_in_scrutinee,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason = "This should be enabled but it's currently too noisy"
)]

Expand Down
10 changes: 5 additions & 5 deletions apps/hash-graph/libs/graph/src/store/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use crate::{
};

pub trait QueryResult<R, S: Sorting> {
type Artifacts: Send;
type Indices: Send;

fn decode_record(&self, artifacts: &Self::Artifacts) -> R;
fn decode_cursor(&self, artifacts: &Self::Artifacts) -> <S as Sorting>::Cursor;
fn decode_record(&self, indices: &Self::Indices) -> R;
fn decode_cursor(&self, indices: &Self::Indices) -> <S as Sorting>::Cursor;
}

pub trait Sorting {
Expand Down Expand Up @@ -165,7 +165,7 @@ pub trait ReadPaginated<R: QueryRecord, S: Sorting + Sync = VertexIdSorting<R>>:
Output = Result<
(
Self::ReadPaginatedStream,
<Self::QueryResult as QueryResult<R, S>>::Artifacts,
<Self::QueryResult as QueryResult<R, S>>::Indices,
),
QueryError,
>,
Expand All @@ -183,7 +183,7 @@ pub trait ReadPaginated<R: QueryRecord, S: Sorting + Sync = VertexIdSorting<R>>:
Output = Result<
(
Vec<Self::QueryResult>,
<Self::QueryResult as QueryResult<R, S>>::Artifacts,
<Self::QueryResult as QueryResult<R, S>>::Indices,
),
QueryError,
>,
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/libs/graph/src/store/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ where
) -> Result<
(
Self::ReadPaginatedStream,
<Self::QueryResult as QueryResult<R, S>>::Artifacts,
<Self::QueryResult as QueryResult<R, S>>::Indices,
),
QueryError,
> {
Expand Down
20 changes: 10 additions & 10 deletions apps/hash-graph/libs/graph/src/store/postgres/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ use crate::{
subgraph::temporal_axes::QueryTemporalAxes,
};

pub struct QueryArtifacts<R: QueryRecordDecode, S: QueryRecordDecode> {
record_indices: R::CompilationArtifacts,
cursor_indices: S::CompilationArtifacts,
pub struct QueryIndices<R: QueryRecordDecode, S: QueryRecordDecode> {
record_indices: R::Indices,
cursor_indices: S::Indices,
}

pub trait QueryRecordDecode {
type CompilationArtifacts: Send + Sync + 'static;
type Indices: Send + Sync + 'static;
type Output;

fn decode(row: &Row, artifacts: &Self::CompilationArtifacts) -> Self::Output;
fn decode(row: &Row, indices: &Self::Indices) -> Self::Output;
}

impl<R, S> QueryResult<R, S> for Row
where
R: QueryRecordDecode<Output = R>,
S: Sorting + QueryRecordDecode<Output = S::Cursor>,
{
type Artifacts = QueryArtifacts<R, S>;
type Indices = QueryIndices<R, S>;

fn decode_record(&self, indices: &Self::Artifacts) -> R {
fn decode_record(&self, indices: &Self::Indices) -> R {
R::decode(self, &indices.record_indices)
}

fn decode_cursor(&self, indices: &Self::Artifacts) -> S::Cursor {
fn decode_cursor(&self, indices: &Self::Indices) -> S::Cursor {
S::decode(self, &indices.cursor_indices)
}
}
Expand Down Expand Up @@ -66,7 +66,7 @@ where
sorting: &S,
limit: Option<usize>,
include_drafts: bool,
) -> Result<(Self::ReadPaginatedStream, QueryArtifacts<R, S>), Report<QueryError>> {
) -> Result<(Self::ReadPaginatedStream, QueryIndices<R, S>), Report<QueryError>> {
let cursor_parameters = sorting.encode().change_context(QueryError)?;

let mut compiler = SelectCompiler::new(temporal_axes, include_drafts);
Expand Down Expand Up @@ -95,7 +95,7 @@ where

Ok((
stream.map(|row| row.change_context(QueryError)),
QueryArtifacts {
QueryIndices {
record_indices,
cursor_indices,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ pub struct EntityVertexIdCursorParameters<'p> {
}

impl QueryRecordDecode for VertexIdSorting<Entity> {
type CompilationArtifacts = EntityVertexIdIndices;
type Indices = EntityVertexIdIndices;
type Output = EntityVertexId;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self::Output {
fn decode(row: &Row, indices: &Self::Indices) -> Self::Output {
let ClosedTemporalBound::Inclusive(revision_id) = *row
.get::<_, LeftClosedTemporalInterval<VariableAxis>>(indices.revision_id)
.start();
Expand Down Expand Up @@ -92,7 +92,7 @@ impl<'s> PostgresSorting<'s, Entity> for VertexIdSorting<Entity> {
compiler: &mut SelectCompiler<'p, 'q, Entity>,
parameters: Option<&'p Self::CompilationParameters>,
temporal_axes: &QueryTemporalAxes,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
let revision_id_path = match temporal_axes.variable_time_axis() {
TimeAxis::TransactionTime => &EntityQueryPath::TransactionTime,
TimeAxis::DecisionTime => &EntityQueryPath::DecisionTime,
Expand Down Expand Up @@ -234,10 +234,10 @@ impl Default for EntityRecordPaths<'_> {
}

impl QueryRecordDecode for Entity {
type CompilationArtifacts = EntityRecordRowIndices;
type Indices = EntityRecordRowIndices;
type Output = Self;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self {
fn decode(row: &Row, indices: &Self::Indices) -> Self {
let link_data = {
let left_owned_by_id: Option<Uuid> = row.get(indices.left_entity_owned_by_id);
let left_entity_uuid: Option<Uuid> = row.get(indices.left_entity_uuid);
Expand Down Expand Up @@ -358,7 +358,7 @@ impl PostgresRecord for Entity {
fn compile<'p, 'q: 'p>(
compiler: &mut SelectCompiler<'p, 'q, Self>,
paths: &'p Self::CompilationParameters,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
EntityRecordRowIndices {
owned_by_id: compiler.add_distinct_selection_with_ordering(
&EntityQueryPath::OwnedById,
Expand Down
1 change: 0 additions & 1 deletion apps/hash-graph/libs/graph/src/store/postgres/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::store::{
migration::{Migration, MigrationState, StoreMigration},
};

#[expect(clippy::str_to_string)]
mod embedded {
use refinery::embed_migrations;
embed_migrations!("../../postgres_migrations");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ pub struct DataTypeRowIndices {
}

impl QueryRecordDecode for DataTypeWithMetadata {
type CompilationArtifacts = DataTypeRowIndices;
type Indices = DataTypeRowIndices;
type Output = Self;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self {
fn decode(row: &Row, indices: &Self::Indices) -> Self {
let record_id = OntologyTypeRecordId {
base_url: row.get(indices.base_url),
version: row.get(indices.version),
Expand Down Expand Up @@ -789,7 +789,7 @@ impl PostgresRecord for DataTypeWithMetadata {
fn compile<'p, 'q: 'p>(
compiler: &mut SelectCompiler<'p, 'q, Self>,
_paths: &Self::CompilationParameters,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
DataTypeRowIndices {
base_url: compiler.add_distinct_selection_with_ordering(
&DataTypeQueryPath::BaseUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,10 @@ pub struct EntityTypeRowIndices {
}

impl QueryRecordDecode for EntityTypeWithMetadata {
type CompilationArtifacts = EntityTypeRowIndices;
type Indices = EntityTypeRowIndices;
type Output = Self;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self {
fn decode(row: &Row, indices: &Self::Indices) -> Self {
let record_id = OntologyTypeRecordId {
base_url: row.get(indices.base_url),
version: row.get(indices.version),
Expand Down Expand Up @@ -1156,7 +1156,7 @@ impl PostgresRecord for EntityTypeWithMetadata {
fn compile<'p, 'q: 'p>(
compiler: &mut SelectCompiler<'p, 'q, Self>,
_paths: &Self::CompilationParameters,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
EntityTypeRowIndices {
base_url: compiler.add_distinct_selection_with_ordering(
&EntityTypeQueryPath::BaseUrl,
Expand Down
6 changes: 3 additions & 3 deletions apps/hash-graph/libs/graph/src/store/postgres/ontology/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ pub struct VersionedUrlIndices {
macro_rules! impl_ontology_cursor {
($ty:ty, $query_path:ty) => {
impl QueryRecordDecode for VertexIdSorting<$ty> {
type CompilationArtifacts = VersionedUrlIndices;
type Indices = VersionedUrlIndices;
type Output = <$ty as SubgraphRecord>::VertexId;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self::Output {
fn decode(row: &Row, indices: &Self::Indices) -> Self::Output {
Self::Output {
base_id: BaseUrl::new(row.get(indices.base_url))
.expect("invalid base URL returned from Postgres"),
Expand All @@ -176,7 +176,7 @@ macro_rules! impl_ontology_cursor {
compiler: &mut SelectCompiler<'p, 'q, $ty>,
parameters: Option<&'p Self::CompilationParameters>,
_: &QueryTemporalAxes,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
if let Some(parameters) = parameters {
let base_url_expression = compiler.compile_parameter(&parameters.base_url).0;
let version_expression = compiler.compile_parameter(&parameters.version).0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,10 @@ pub struct PropertyTypeRowIndices {
}

impl QueryRecordDecode for PropertyTypeWithMetadata {
type CompilationArtifacts = PropertyTypeRowIndices;
type Indices = PropertyTypeRowIndices;
type Output = Self;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self {
fn decode(row: &Row, indices: &Self::Indices) -> Self {
let record_id = OntologyTypeRecordId {
base_url: row.get(indices.base_url),
version: row.get(indices.version),
Expand Down Expand Up @@ -930,7 +930,7 @@ impl PostgresRecord for PropertyTypeWithMetadata {
fn compile<'p, 'q: 'p>(
compiler: &mut SelectCompiler<'p, 'q, Self>,
_paths: &Self::CompilationParameters,
) -> Self::CompilationArtifacts {
) -> Self::Indices {
PropertyTypeRowIndices {
base_url: compiler.add_distinct_selection_with_ordering(
&PropertyTypeQueryPath::BaseUrl,
Expand Down
10 changes: 5 additions & 5 deletions apps/hash-graph/libs/graph/src/store/postgres/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub trait PostgresRecord: QueryRecord + QueryRecordDecode<Output = Self> {
fn compile<'p, 'q: 'p>(
compiler: &mut SelectCompiler<'p, 'q, Self>,
paths: &'p Self::CompilationParameters,
) -> Self::CompilationArtifacts;
) -> Self::Indices;
}

/// An absolute path inside of a query pointing to an attribute.
Expand Down Expand Up @@ -110,7 +110,7 @@ pub trait PostgresSorting<'s, R: QueryRecord>:
compiler: &mut SelectCompiler<'p, 'q, R>,
parameters: Option<&'p Self::CompilationParameters>,
temporal_axes: &QueryTemporalAxes,
) -> Self::CompilationArtifacts
) -> Self::Indices
where
's: 'q;
}
Expand Down Expand Up @@ -211,10 +211,10 @@ impl ToSql for CursorField<'_> {
}

impl<'s> QueryRecordDecode for EntityQuerySorting<'s> {
type CompilationArtifacts = Vec<usize>;
type Indices = Vec<usize>;
type Output = EntityQueryCursor<'s>;

fn decode(row: &Row, indices: &Self::CompilationArtifacts) -> Self::Output {
fn decode(row: &Row, indices: &Self::Indices) -> Self::Output {
EntityQueryCursor {
values: indices.iter().map(|i| row.get(i)).collect(),
}
Expand All @@ -237,7 +237,7 @@ where
compiler: &mut SelectCompiler<'p, 'q, Entity>,
_: Option<&'p Self::CompilationParameters>,
_: &QueryTemporalAxes,
) -> Self::CompilationArtifacts
) -> Self::Indices
where
's: 'q,
{
Expand Down
10 changes: 5 additions & 5 deletions apps/hash-graph/libs/graph/src/subgraph/edges/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub trait EdgeEndpointSet: IntoIterator<Item = Self::EdgeEndpoint> {
impl<S: BuildHasher, E: EdgeEndpoint + Eq + Hash> EdgeEndpointSet for HashSet<E, S> {
type EdgeEndpoint = E;

fn insert(&mut self, edge_target_id: Self::EdgeEndpoint) {
Self::insert(self, edge_target_id);
fn insert(&mut self, target_id: Self::EdgeEndpoint) {
Self::insert(self, target_id);
}
}

Expand Down Expand Up @@ -89,10 +89,10 @@ impl IntoIterator for EntityIdWithIntervalSet {
impl EdgeEndpointSet for EntityIdWithIntervalSet {
type EdgeEndpoint = EntityIdWithInterval;

fn insert(&mut self, edge_target_id: Self::EdgeEndpoint) {
fn insert(&mut self, target_id: Self::EdgeEndpoint) {
self.inner
.entry(edge_target_id.entity_id)
.entry(target_id.entity_id)
.or_default()
.insert(edge_target_id.interval);
.insert(target_id.interval);
}
}
2 changes: 1 addition & 1 deletion apps/hash-graph/libs/graph/src/subgraph/edges/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl GraphResolveDepths {
}

pub trait GraphResolveDepthIndex {
fn depth_mut(self, direction: EdgeDirection, dephts: &mut GraphResolveDepths) -> &mut u8;
fn depth_mut(self, direction: EdgeDirection, depths: &mut GraphResolveDepths) -> &mut u8;
}

impl GraphResolveDepthIndex for OntologyEdgeKind {
Expand Down
2 changes: 1 addition & 1 deletion apps/hash/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ To run HASH locally, please follow these steps:
## β‰₯ 1.16

rustc --version
## β‰₯ 2024-05-20 (If installed through rustup, this will automatically install the required toolchain)
## β‰₯ 2024-05-27 (If installed through rustup, this will automatically install the required toolchain)

cargo --version
## Version matching the above rustc version
Expand Down
4 changes: 2 additions & 2 deletions libs/@local/codec/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ impl<T: DeserializeOwned> Decoder for JsonLinesDecoder<T> {
type Error = Report<io::Error>;
type Item = T;

fn decode(&mut self, buf: &mut BytesMut) -> Result<Option<T>, Self::Error> {
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<T>, Self::Error> {
self.lines
.decode(buf)
.decode(src)
.map(|line| {
self.current_line += 1;
line
Expand Down
Loading