Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump toolchain to nightly-2022-09-15 #1067

Merged
merged 4 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 12 additions & 11 deletions packages/graph/hash_graph/lib/graph/src/api/rest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,18 @@ pub fn rest_api_router<P: StorePool + Send + 'static>(
async fn serve_static_schema(Path(path): Path<String>) -> Result<Response, StatusCode> {
let path = path.trim_start_matches('/');

match STATIC_SCHEMAS.get_file(path) {
None => Err(StatusCode::NOT_FOUND),
Some(file) => Ok((
[(
axum::http::header::CONTENT_TYPE,
axum::http::HeaderValue::from_static("application/json"),
)],
file.contents(),
)
.into_response()),
}
STATIC_SCHEMAS
.get_file(path)
.map_or(Err(StatusCode::NOT_FOUND), |file| {
Ok((
[(
axum::http::header::CONTENT_TYPE,
axum::http::HeaderValue::from_static("application/json"),
)],
file.contents(),
)
.into_response())
})
}

#[derive(OpenApi)]
Expand Down
2 changes: 0 additions & 2 deletions packages/graph/hash_graph/lib/graph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#![feature(lint_reasons)]
// Not required, reason: Use `std` feature rather than external crate
#![feature(once_cell)]
// Not required, reason: Easier than having a separated trait with lifetime bounds
#![feature(generic_associated_types)]
// Not required, reason: Simpler than using blanket implementations
#![feature(trait_alias)]
// Not required, reason: much more simple bounds
Expand Down
17 changes: 11 additions & 6 deletions packages/graph/hash_graph/lib/graph/src/logging/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ pub fn init_logger<P: AsRef<Path>>(
let log_folder = log_folder.as_ref();

let filter = log_level.map_or_else(
|| match std::env::var("RUST_LOG") {
Ok(env) => EnvFilter::new(env),
#[cfg(debug_assertions)]
_ => EnvFilter::default().add_directive(Directive::from(LevelFilter::DEBUG)),
#[cfg(not(debug_assertions))]
_ => EnvFilter::default().add_directive(Directive::from(LevelFilter::WARN)),
|| {
std::env::var("RUST_LOG").map_or_else(
|_| {
if cfg!(debug_assertions) {
EnvFilter::default().add_directive(Directive::from(LevelFilter::DEBUG))
} else {
EnvFilter::default().add_directive(Directive::from(LevelFilter::WARN))
}
},
EnvFilter::new,
)
},
|log_level| EnvFilter::default().add_directive(Directive::from(log_level)),
);
Expand Down
4 changes: 1 addition & 3 deletions packages/graph/hash_graph/lib/graph/src/store/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ pub trait StorePool: Sync {
type Error;

/// The store returned when acquiring.
type Store<'pool>: Store + Send
where
Self: 'pool;
type Store<'pool>: Store + Send;

/// Retrieves a [`Store`] from the pool.
async fn acquire(&self) -> Result<Self::Store<'_>, Self::Error>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pub struct EntityRecord {

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

fn row_stream_to_record_stream(row_stream: RowStream) -> RecordStream {
fn row_stream_to_record_stream(
row_stream: RowStream,
) -> impl Stream<Item = Result<EntityRecord, QueryError>> {
Alfred-Mountfield marked this conversation as resolved.
Show resolved Hide resolved
row_stream.map(|row_result| {
let row = row_result.into_report().change_context(QueryError)?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ pub struct LinkRecord {

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ pub struct OntologyRecord<T> {
pub is_latest: bool,
}

fn row_stream_to_record_stream<T>(row_stream: RowStream) -> RecordStream<T>
fn row_stream_to_record_stream<T>(
row_stream: RowStream,
) -> impl Stream<Item = Result<OntologyRecord<T>, QueryError>>
where
T: TryFrom<serde_json::Value, Error: Context>,
{
Expand Down
3 changes: 2 additions & 1 deletion packages/graph/hash_graph/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "nightly-2022-08-08"
channel = "nightly-2022-09-15"
components = ['rust-src', 'clippy', 'rustfmt']