Run cargo fmt in CI (#431)

<!-- Thank you for submitting this PR! :) -->

## Description

When I run `cargo fmt` on my branches, it makes more diff than I want.
This PR fixes that by adding `just format` / `just fmt`, and adding it
to a CI job.

<!--
  Questions to consider answering:
  1. What user-facing changes are being made?
2. What are issues related to this PR? (Consider adding `(close
#<issue-no>)` to the PR title)
  3. What is the conceptual design behind this PR?
  4. How can this PR be tested/verified?
  5. Does the PR have limitations?
  6. Does the PR introduce breaking changes?
-->

## Changelog

- Add a changelog entry (in the "Changelog entry" section below) if the
changes in this PR have any user-facing impact. See [changelog
guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide).
- If no changelog is required ignore/remove this section and add a
`no-changelog-required` label to the PR.

### Product
_(Select all products this will be available in)_
- [ ] community-edition
- [ ] cloud
<!-- product : end : DO NOT REMOVE -->

### Type
<!-- See changelog structure:
https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog
-->
_(Select only one. In case of multiple, choose the most appropriate)_
- [ ] highlight
- [ ] enhancement
- [ ] bugfix
- [ ] behaviour-change
- [ ] performance-enhancement
- [ ] security-fix
<!-- type : end : DO NOT REMOVE -->

### Changelog entry
<!--
  - Add a user understandable changelog entry
- Include all details needed to understand the change. Try including
links to docs or issues if relevant
  - For Highlights start with a H4 heading (#### <entry title>)
  - Get the changelog entry reviewed by your team
-->

_Replace with changelog entry_

<!-- changelog-entry : end : DO NOT REMOVE -->

<!-- changelog : end : DO NOT REMOVE -->

V3_GIT_ORIGIN_REV_ID: e31e352f27b9ad0129c3759fead051b1a8d86758
This commit is contained in:
Tom Harding 2024-04-02 17:08:38 +02:00 committed by hasura-bot
parent cc9cedc268
commit ec62ea463c
5 changed files with 97 additions and 80 deletions

View File

@ -433,13 +433,15 @@ fn eval_order_by_element(
column,
function,
),
ndc_models::OrderByTarget::StarCountAggregate { path } => eval_order_by_star_count_aggregate(
ndc_models::OrderByTarget::StarCountAggregate { path } => {
eval_order_by_star_count_aggregate(
collection_relationships,
variables,
state,
item,
path,
),
)
}
}
}
@ -999,8 +1001,8 @@ pub(crate) fn eval_nested_field(
state,
&full_row,
)?;
Ok(ndc_models::RowFieldValue(serde_json::to_value(row).map_err(
|_| {
Ok(ndc_models::RowFieldValue(
serde_json::to_value(row).map_err(|_| {
(
StatusCode::INTERNAL_SERVER_ERROR,
Json(ndc_models::ErrorResponse {
@ -1008,8 +1010,8 @@ pub(crate) fn eval_nested_field(
details: serde_json::Value::Null,
}),
)
},
)?))
})?,
))
}
ndc_models::NestedField::Array(ndc_models::NestedArray { fields }) => {
let array: Vec<serde_json::Value> = serde_json::from_value(value).map_err(|_| {

View File

@ -26,7 +26,10 @@ pub async fn execute_ndc_query<'n, 's>(
) -> Result<Vec<ndc_models::RowSet>, error::Error> {
let tracer = tracing_util::global_tracer();
tracer
.in_span_async("Execute query using data connector", SpanVisibility::User, || {
.in_span_async(
"Execute query using data connector",
SpanVisibility::User,
|| {
Box::pin(async {
set_attribute_on_active_span(
AttributeVisibility::Default,
@ -43,7 +46,8 @@ pub async fn execute_ndc_query<'n, 's>(
.await?;
Ok(connector_response.0)
})
})
},
)
.await
}
@ -109,7 +113,10 @@ pub(crate) async fn execute_ndc_mutation<'n, 's, 'ir>(
) -> Result<json::Value, error::Error> {
let tracer = tracing_util::global_tracer();
tracer
.in_span_async("Execute mutation using data connector", SpanVisibility::User, || {
.in_span_async(
"Execute mutation using data connector",
SpanVisibility::User,
|| {
Box::pin(async {
set_attribute_on_active_span(
AttributeVisibility::Default,
@ -158,7 +165,8 @@ pub(crate) async fn execute_ndc_mutation<'n, 's, 'ir>(
}
})
})
})
},
)
.await
}

View File

@ -27,7 +27,10 @@ pub struct DataConnectorLink {
}
impl std::hash::Hash for DataConnectorLink {
fn hash<H>(&self, h: &mut H) where H: std::hash::Hasher {
fn hash<H>(&self, h: &mut H)
where
H: std::hash::Hasher,
{
self.name.hash(h)
}
}

View File

@ -44,6 +44,10 @@ ci-lint:
fix:
just docker_with_source_only sh -c "cargo clippy --no-deps --fix --allow-no-vcs -- {{ CLIPPY_FIX_ARGS }}; cargo fmt"
format:
cargo fmt --check
alias fmt := format
fix-local:
cargo clippy --no-deps --fix --allow-no-vcs -- {{ CLIPPY_FIX_ARGS }}; cargo fmt