Skip to content

Commit

Permalink
Set error_on_unformatted for rustfmt (#1043)
Browse files Browse the repository at this point in the history
* Set `error_on_unformatted`
* Satisfy rustfmt
  • Loading branch information
TimDiekmann authored Sep 8, 2022
1 parent acd1f23 commit 37e7cd0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
23 changes: 13 additions & 10 deletions packages/graph/hash_graph/lib/graph/src/api/rest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,19 @@ pub fn rest_api_router<P: StorePool + Send + 'static>(store: Arc<P>) -> Router {
let open_api_doc = OpenApiDocumentation::openapi();

// super-router can then be used as any other router.
merged_routes
// Make sure extensions are added at the end so they are made available to merged routers.
.layer(Extension(store))
.nest("/api-doc", Router::new().route(
"/openapi.json",
get({
let doc = open_api_doc;
move || async { Json(doc) }
})).route("/models/*path", get(serve_static_schema)),
)
// Make sure extensions are added at the end so they are made available to merged routers.
merged_routes.layer(Extension(store)).nest(
"/api-doc",
Router::new()
.route(
"/openapi.json",
get({
let doc = open_api_doc;
move || async { Json(doc) }
}),
)
.route("/models/*path", get(serve_static_schema)),
)
}

#[allow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ where
&format!(
r#"
SELECT schema, created_by, (
SELECT MAX(version) as latest
FROM ids
SELECT MAX(version) as latest
FROM ids
WHERE base_uri = $1
)
FROM {} type_table
Expand Down
10 changes: 5 additions & 5 deletions packages/graph/hash_graph/lib/graph/src/store/postgres/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ where
self.as_client()
.query_one(
r#"
INSERT INTO base_uris (base_uri)
INSERT INTO base_uris (base_uri)
VALUES ($1)
RETURNING base_uri;
"#,
Expand All @@ -217,7 +217,7 @@ where
self.as_client()
.query_one(
r#"
INSERT INTO version_ids (version_id)
INSERT INTO version_ids (version_id)
VALUES ($1)
RETURNING version_id;
"#,
Expand Down Expand Up @@ -578,7 +578,7 @@ where
.change_context(InsertionError)?;
let version = self.as_client().query_one(
r#"
INSERT INTO entities (entity_id, version, entity_type_version_id, properties, created_by)
INSERT INTO entities (entity_id, version, entity_type_version_id, properties, created_by)
VALUES ($1, clock_timestamp(), $2, $3, $4)
RETURNING version;
"#,
Expand Down Expand Up @@ -634,7 +634,7 @@ where

self.as_client()
.query_one(
// TODO: Currently we insert `null` for the `link_order`, this needs to change as we
// TODO: Currently we insert `null` for the `link_order`, this needs to change as we
// implement ordered links.
// https://app.asana.com/0/1202805690238892/1202937382769278/f
r#"
Expand Down Expand Up @@ -680,7 +680,7 @@ where
r#"
WITH removed AS (
DELETE FROM links
WHERE source_entity_id = $1
WHERE source_entity_id = $1
AND target_entity_id = $2
AND link_type_version_id = $3
RETURNING source_entity_id, target_entity_id, link_type_version_id,
Expand Down
3 changes: 3 additions & 0 deletions packages/graph/hash_graph/rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ format_strings = true # Default: false
# Imports
imports_granularity = "Crate" # Default: "Preserve"
group_imports = "StdExternalCrate" # Default: "Preserve"

# Diagnostics
error_on_unformatted = true # Default: false

0 comments on commit 37e7cd0

Please sign in to comment.