Skip to content

Commit 19f71d7

Browse files
authored
Bump toolchain to nightly-2022-09-14 (#1067)
1 parent 5e1fbd2 commit 19f71d7

File tree

8 files changed

+38
-28
lines changed

8 files changed

+38
-28
lines changed

packages/graph/hash_graph/lib/graph/src/api/rest/mod.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,18 @@ pub fn rest_api_router<P: StorePool + Send + 'static>(
146146
async fn serve_static_schema(Path(path): Path<String>) -> Result<Response, StatusCode> {
147147
let path = path.trim_start_matches('/');
148148

149-
match STATIC_SCHEMAS.get_file(path) {
150-
None => Err(StatusCode::NOT_FOUND),
151-
Some(file) => Ok((
152-
[(
153-
axum::http::header::CONTENT_TYPE,
154-
axum::http::HeaderValue::from_static("application/json"),
155-
)],
156-
file.contents(),
157-
)
158-
.into_response()),
159-
}
149+
STATIC_SCHEMAS
150+
.get_file(path)
151+
.map_or(Err(StatusCode::NOT_FOUND), |file| {
152+
Ok((
153+
[(
154+
axum::http::header::CONTENT_TYPE,
155+
axum::http::HeaderValue::from_static("application/json"),
156+
)],
157+
file.contents(),
158+
)
159+
.into_response())
160+
})
160161
}
161162

162163
#[derive(OpenApi)]

packages/graph/hash_graph/lib/graph/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#![feature(lint_reasons)]
55
// Not required, reason: Use `std` feature rather than external crate
66
#![feature(once_cell)]
7-
// Not required, reason: Easier than having a separated trait with lifetime bounds
8-
#![feature(generic_associated_types)]
97
// Not required, reason: Simpler than using blanket implementations
108
#![feature(trait_alias)]
119
// Not required, reason: much more simple bounds

packages/graph/hash_graph/lib/graph/src/logging/init.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ pub fn init_logger<P: AsRef<Path>>(
6060
let log_folder = log_folder.as_ref();
6161

6262
let filter = log_level.map_or_else(
63-
|| match std::env::var("RUST_LOG") {
64-
Ok(env) => EnvFilter::new(env),
65-
#[cfg(debug_assertions)]
66-
_ => EnvFilter::default().add_directive(Directive::from(LevelFilter::DEBUG)),
67-
#[cfg(not(debug_assertions))]
68-
_ => EnvFilter::default().add_directive(Directive::from(LevelFilter::WARN)),
63+
|| {
64+
std::env::var("RUST_LOG").map_or_else(
65+
|_| {
66+
if cfg!(debug_assertions) {
67+
EnvFilter::default().add_directive(Directive::from(LevelFilter::DEBUG))
68+
} else {
69+
EnvFilter::default().add_directive(Directive::from(LevelFilter::WARN))
70+
}
71+
},
72+
EnvFilter::new,
73+
)
6974
},
7075
|log_level| EnvFilter::default().add_directive(Directive::from(log_level)),
7176
);

packages/graph/hash_graph/lib/graph/src/store/pool.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ pub trait StorePool: Sync {
1010
type Error;
1111

1212
/// The store returned when acquiring.
13-
type Store<'pool>: Store + Send
14-
where
15-
Self: 'pool;
13+
type Store<'pool>: Store + Send;
1614

1715
/// Retrieves a [`Store`] from the pool.
1816
async fn acquire(&self) -> Result<Self::Store<'_>, Self::Error>;

packages/graph/hash_graph/lib/graph/src/store/postgres/context/entity.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ pub struct EntityRecord {
2121

2222
pub type RecordStream = impl Stream<Item = Result<EntityRecord, QueryError>>;
2323

24-
fn row_stream_to_record_stream(row_stream: RowStream) -> RecordStream {
24+
fn row_stream_to_record_stream(
25+
row_stream: RowStream,
26+
) -> impl Stream<Item = Result<EntityRecord, QueryError>> {
2527
row_stream.map(|row_result| {
2628
let row = row_result.into_report().change_context(QueryError)?;
2729

@@ -40,7 +42,7 @@ fn row_stream_to_record_stream(row_stream: RowStream) -> RecordStream {
4042
}
4143

4244
pub async fn read_all_entities(client: &impl AsClient) -> Result<RecordStream, QueryError> {
43-
let row_stream= client
45+
let row_stream = client
4446
.as_client()
4547
.query_raw(
4648
r#"
@@ -53,7 +55,8 @@ pub async fn read_all_entities(client: &impl AsClient) -> Result<RecordStream, Q
5355
parameter_list([]),
5456
)
5557
.await
56-
.into_report().change_context(QueryError)?;
58+
.into_report()
59+
.change_context(QueryError)?;
5760
Ok(row_stream_to_record_stream(row_stream))
5861
}
5962

packages/graph/hash_graph/lib/graph/src/store/postgres/context/links.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ pub struct LinkRecord {
1818

1919
pub type RecordStream = impl Stream<Item = Result<LinkRecord, QueryError>>;
2020

21-
fn row_stream_to_record_stream(row_stream: RowStream) -> RecordStream {
21+
fn row_stream_to_record_stream(
22+
row_stream: RowStream,
23+
) -> impl Stream<Item = Result<LinkRecord, QueryError>> {
2224
row_stream.map(|row_result| {
2325
let row = row_result.into_report().change_context(QueryError)?;
2426

packages/graph/hash_graph/lib/graph/src/store/postgres/context/ontology.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ pub struct OntologyRecord<T> {
2727
pub is_latest: bool,
2828
}
2929

30-
fn row_stream_to_record_stream<T>(row_stream: RowStream) -> RecordStream<T>
30+
fn row_stream_to_record_stream<T>(
31+
row_stream: RowStream,
32+
) -> impl Stream<Item = Result<OntologyRecord<T>, QueryError>>
3133
where
3234
T: TryFrom<serde_json::Value, Error: Context>,
3335
{
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2022-08-08"
2+
channel = "nightly-2022-09-15"
3+
components = ['rust-src', 'clippy', 'rustfmt']

0 commit comments

Comments
 (0)