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

[chore] Update to Rust v1.82 #19903

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions crates/sui-graphql-rpc-client/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl GraphqlResponse {
})
}

#[allow(clippy::result_large_err)]
pub fn graphql_version(&self) -> Result<String, ClientError> {
Ok(self
.headers
Expand Down Expand Up @@ -85,6 +86,7 @@ impl GraphqlResponse {
self.full_response.errors.clone()
}

#[allow(clippy::result_large_err)]
pub fn usage(&self) -> Result<Option<BTreeMap<String, u64>>, ClientError> {
Ok(match self.full_response.extensions.get("usage").cloned() {
Some(Value::Object(obj)) => Some(
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-graphql-rpc-client/src/simple_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl SimpleClient {
}
}

#[allow(clippy::type_complexity)]
#[allow(clippy::type_complexity, clippy::result_large_err)]
pub fn resolve_variables(
vars: &[GraphqlQueryVariable],
) -> Result<(BTreeMap<String, String>, BTreeMap<String, Value>), ClientError> {
Expand Down
30 changes: 22 additions & 8 deletions crates/suiop-cli/src/cli/notion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum Error {
JsonParseError { source: serde_json::Error },

#[error("Unexpected API Response")]
UnexpectedResponse { response: Object },
UnexpectedResponse { response: Box<Object> },

#[error("API Error {}({}): {}", .error.code, .error.status, .error.message)]
ApiError { error: ErrorResponse },
Expand Down Expand Up @@ -122,7 +122,9 @@ impl NotionApi {

match self.make_json_request(builder).await? {
Object::List { list } => Ok(list.expect_databases()?),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -143,7 +145,9 @@ impl NotionApi {

match result {
Object::List { list } => Ok(list),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -161,7 +165,9 @@ impl NotionApi {

match result {
Object::Database { database } => Ok(database),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -176,7 +182,9 @@ impl NotionApi {

match result {
Object::Page { page } => Ok(page),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -192,7 +200,9 @@ impl NotionApi {

match result {
Object::Page { page } => Ok(page),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -218,7 +228,9 @@ impl NotionApi {
.await?;
match result {
Object::List { list } => Ok(list.expect_pages()?),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}

Expand All @@ -235,7 +247,9 @@ impl NotionApi {

match result {
Object::List { list } => Ok(list.expect_blocks()?),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
}
}
}
12 changes: 9 additions & 3 deletions crates/suiop-cli/src/cli/notion/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ impl ListResponse<Object> {
.into_iter()
.map(|object| match object {
Object::Database { database } => Ok(database),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
})
.collect();

Expand All @@ -143,7 +145,9 @@ impl ListResponse<Object> {
.into_iter()
.map(|object| match object {
Object::Page { page } => Ok(page),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
})
.collect();

Expand All @@ -160,7 +164,9 @@ impl ListResponse<Object> {
.into_iter()
.map(|object| match object {
Object::Block { block } => Ok(block),
response => Err(Error::UnexpectedResponse { response }),
response => Err(Error::UnexpectedResponse {
response: Box::new(response),
}),
})
.collect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,9 @@ macro_rules! ice_assert {
pub fn print_stack_trace() {
use std::backtrace::{Backtrace, BacktraceStatus};
let stacktrace = Backtrace::capture();
match stacktrace.status() {
BacktraceStatus::Captured => {
eprintln!("stacktrace:");
eprintln!("{}", stacktrace);
}
BacktraceStatus::Unsupported | BacktraceStatus::Disabled | _ => (),
if let BacktraceStatus::Captured = stacktrace.status() {
eprintln!("stacktrace:");
eprintln!("{}", stacktrace);
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.81"
channel = "1.82"
Loading