Skip to content
New issue

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

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

Already on GitHub? # to your account

pedantic Clippy fixes #512

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cba75ea
fix formatting
Feb 11, 2025
e732145
use inline format args (clippy::uninlined_format_args)
Jan 31, 2025
9fc24cc
use 'Self' keyword (clippy::use_self)
Jan 31, 2025
890979d
use semicolon if nothing returned (clippy::semicolon_if_nothing_retur…
Jan 31, 2025
3fbac33
remove explicit 'iter' loops (clippy::explicit_iter_loop)
Jan 31, 2025
11d2494
avoid cloning when you can copy (clippy::cloned_instead_of_copied)
Jan 31, 2025
47f7315
remove unnecessary semicolons (clippy::unnecessary_semicolons)
Jan 31, 2025
fc76085
nest or patterns (clippy::unnested_or_patterns)
Jan 31, 2025
f78c26c
use 'if let' rather than single match 'else' block (clippy::single_ma…
Jan 31, 2025
b4a69b7
collapse some 'if else' blocks
Jan 31, 2025
81abeb1
remove needless raw string hashes (clippy::needless_raw_string_hashes)
Jan 31, 2025
72b4292
remove wildcard imports (clippy::wildcard_imports)
Jan 31, 2025
d43b207
bump MSRV
Jan 31, 2025
0e9fb1a
flip unnecessary booleans (clippy::if_not_else)
Jan 31, 2025
6188068
remove redundant 'else' block (clippy::redundant_else)
Jan 31, 2025
cf12498
use 'assert' macro (clippy::manual_assert)
Jan 31, 2025
11714a6
explicitly match unit values (clippy::ignored_unit_patterns)
Jan 31, 2025
50c184b
remove some redundant closures (clippy::redundant_closure)
danieleades Feb 2, 2025
d52a52d
remove use of 'lazy_static' (clippy::non_std_lazy_statics)
danieleades Feb 2, 2025
a65d465
bump msrv
danieleades Feb 2, 2025
6cf0477
remove some needlessly mutable references (clippy::needless_pass_by_r…
danieleades Feb 2, 2025
154d29d
general refactoring
danieleades Feb 2, 2025
2ec7fc9
deglob another import
danieleades Feb 2, 2025
bacc011
remove unnecessary wraps (clippy::unnecessary_wraps)
danieleades Feb 2, 2025
d2f53d0
minor refactoring
Feb 7, 2025
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
77 changes: 9 additions & 68 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ members = [
]

[workspace.package]
rust-version = "1.64.0"
rust-version = "1.80.1"
8 changes: 4 additions & 4 deletions examples/github/examples/github.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use ::reqwest::blocking::Client;
use anyhow::*;
use anyhow::{format_err, Ok, Result};
use clap::Parser;
use graphql_client::{reqwest::post_graphql_blocking as post_graphql, GraphQLQuery};
use log::*;
use prettytable::*;
use log::info;
use prettytable::row;

#[allow(clippy::upper_case_acronyms)]
type URI = String;
@@ -52,7 +52,7 @@ fn main() -> Result<(), anyhow::Error> {
.default_headers(
std::iter::once((
reqwest::header::AUTHORIZATION,
reqwest::header::HeaderValue::from_str(&format!("Bearer {}", github_api_token))
reqwest::header::HeaderValue::from_str(&format!("Bearer {github_api_token}"))
.unwrap(),
))
.collect(),
10 changes: 7 additions & 3 deletions examples/hasura/examples/hasura.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ::reqwest::blocking::Client;
use graphql_client::{reqwest::post_graphql_blocking as post_graphql, GraphQLQuery};
use log::*;
use prettytable::*;
use log::{error, info};
use prettytable::row;

type Bpchar = String;
type Timestamptz = String;
@@ -16,7 +16,11 @@ type Timestamptz = String;
struct UpsertIssue;

fn main() -> Result<(), anyhow::Error> {
use upsert_issue::{IssuesUpdateColumn::*, *};
use upsert_issue::{
IssuesInsertInput,
IssuesUpdateColumn::{Name, SalesforceUpdatedAt, Status},
Variables,
};
env_logger::init();

let v = Variables {
1 change: 0 additions & 1 deletion examples/web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
graphql_client = { path = "../../graphql_client", features = ["reqwest"] }
wasm-bindgen = "^0.2"
lazy_static = "1.0.1"
js-sys = "0.3.6"
wasm-bindgen-futures = "0.4.18"
reqwest = "0.12"
15 changes: 6 additions & 9 deletions examples/web/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use graphql_client::{reqwest::post_graphql, GraphQLQuery};
use lazy_static::*;
use std::cell::RefCell;
use std::sync::Mutex;
use wasm_bindgen::prelude::*;
@@ -15,12 +14,11 @@ use wasm_bindgen_futures::future_to_promise;
struct PuppySmiles;

fn log(s: &str) {
web_sys::console::log_1(&JsValue::from_str(s))
web_sys::console::log_1(&JsValue::from_str(s));
}

lazy_static! {
static ref LAST_ENTRY: Mutex<RefCell<Option<String>>> = Mutex::new(RefCell::new(None));
}
static LAST_ENTRY: std::sync::LazyLock<Mutex<RefCell<Option<String>>>> =
std::sync::LazyLock::new(|| Mutex::new(RefCell::new(None)));

async fn load_more() -> Result<JsValue, JsValue> {
let url = "https://www.graphqlhub.com/graphql";
@@ -36,7 +34,7 @@ async fn load_more() -> Result<JsValue, JsValue> {
let response = post_graphql::<PuppySmiles, _>(&client, url, variables)
.await
.map_err(|err| {
log(&format!("Could not fetch puppies. error: {:?}", err));
log(&format!("Could not fetch puppies. error: {err:?}"));
JsValue::NULL
})?;
render_response(response);
@@ -77,7 +75,7 @@ fn add_load_more_button() {
fn render_response(response: graphql_client::Response<puppy_smiles::ResponseData>) {
use std::fmt::Write;

log(&format!("response body\n\n{:?}", response));
log(&format!("response body\n\n{response:?}"));

let parent = document().body().expect_throw("no body");

@@ -116,8 +114,7 @@ fn render_response(response: graphql_client::Response<puppy_smiles::ResponseData
.expect_throw("write to string");
}
response.set_inner_html(&format!(
"<h2>response:</h2><div class=\"container\"><div class=\"row\">{}</div></div>",
inner_html
"<h2>response:</h2><div class=\"container\"><div class=\"row\">{inner_html}</div></div>"
));
parent
.append_child(&response)
Loading