Skip to content

Commit 3688064

Browse files
committed
Clippy
1 parent 731b159 commit 3688064

File tree

11 files changed

+17
-44
lines changed

11 files changed

+17
-44
lines changed

crates/salsa/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ rand = "0.8.5"
3030
test-log = "0.2.14"
3131
expect-test = "1.4.0"
3232
dissimilar = "1.0.7"
33+
34+
[lints]
35+
workspace = true

crates/salsa/salsa-macros/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ heck = "0.4"
1818
proc-macro2 = "1.0"
1919
quote = "1.0"
2020
syn = { version = "2.0", features = ["full", "extra-traits"] }
21+
22+
[lints]
23+
workspace = true

crates/salsa/salsa-macros/src/database_storage.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
203203

204204
output.extend(has_group_impls);
205205

206-
if std::env::var("SALSA_DUMP").is_ok() {
207-
println!("~~~ database_storage");
208-
println!("{}", output);
209-
println!("~~~ database_storage");
210-
}
211-
212206
output.into()
213207
}
214208

@@ -218,7 +212,7 @@ struct QueryGroupList {
218212
}
219213

220214
impl Parse for QueryGroupList {
221-
fn parse(input: ParseStream) -> syn::Result<Self> {
215+
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
222216
let query_groups: PunctuatedQueryGroups =
223217
input.parse_terminated(QueryGroup::parse, Token![,])?;
224218
Ok(QueryGroupList { query_groups })
@@ -241,7 +235,7 @@ impl Parse for QueryGroup {
241235
/// ```ignore
242236
/// impl HelloWorldDatabase;
243237
/// ```
244-
fn parse(input: ParseStream) -> syn::Result<Self> {
238+
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
245239
let group_path: Path = input.parse()?;
246240
Ok(QueryGroup { group_path })
247241
}
@@ -250,7 +244,7 @@ impl Parse for QueryGroup {
250244
struct Nothing;
251245

252246
impl Parse for Nothing {
253-
fn parse(_input: ParseStream) -> syn::Result<Self> {
247+
fn parse(_input: ParseStream<'_>) -> syn::Result<Self> {
254248
Ok(Nothing)
255249
}
256250
}

crates/salsa/salsa-macros/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
#![recursion_limit = "256"]
44

5-
extern crate proc_macro;
6-
extern crate proc_macro2;
75
#[macro_use]
86
extern crate quote;
97

crates/salsa/salsa-macros/src/parenthesized.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ impl<T> syn::parse::Parse for Parenthesized<T>
55
where
66
T: syn::parse::Parse,
77
{
8-
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
8+
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
99
let content;
1010
syn::parenthesized!(content in input);
1111
content.parse::<T>().map(Parenthesized)

crates/salsa/salsa-macros/src/query_group.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -625,13 +625,6 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
625625
}
626626
// ANCHOR_END:group_storage_methods
627627
});
628-
629-
if std::env::var("SALSA_DUMP").is_ok() {
630-
println!("~~~ query_group");
631-
println!("{}", output);
632-
println!("~~~ query_group");
633-
}
634-
635628
output.into()
636629
}
637630

crates/salsa/tests/cycles.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct Error {
5151
}
5252

5353
#[salsa::database(GroupStruct)]
54+
#[derive(Default)]
5455
struct DatabaseImpl {
5556
storage: salsa::Storage<Self>,
5657
}
@@ -63,14 +64,6 @@ impl ParallelDatabase for DatabaseImpl {
6364
}
6465
}
6566

66-
impl Default for DatabaseImpl {
67-
fn default() -> Self {
68-
let res = DatabaseImpl { storage: salsa::Storage::default() };
69-
70-
res
71-
}
72-
}
73-
7467
/// The queries A, B, and C in `Database` can be configured
7568
/// to invoke one another in arbitrary ways using this
7669
/// enum.
@@ -151,17 +144,14 @@ impl CycleQuery {
151144
}
152145

153146
fn cycle_a(db: &dyn Database) -> Result<(), Error> {
154-
dbg!("cycle_a");
155147
db.a_invokes().invoke(db)
156148
}
157149

158150
fn cycle_b(db: &dyn Database) -> Result<(), Error> {
159-
dbg!("cycle_b");
160151
db.b_invokes().invoke(db)
161152
}
162153

163154
fn cycle_c(db: &dyn Database) -> Result<(), Error> {
164-
dbg!("cycle_c");
165155
db.c_invokes().invoke(db)
166156
}
167157

crates/salsa/tests/incremental/implementation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ impl TestContextImpl {
3333
return;
3434
}
3535

36+
#[allow(clippy::print_stdout)]
3637
for diff in dissimilar::diff(expected_text, actual_text) {
3738
match diff {
3839
dissimilar::Chunk::Delete(l) => println!("-{}", l),

crates/salsa/tests/no_send_sync.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate salsa;
2-
31
use std::rc::Rc;
42

53
#[salsa::query_group(NoSendSyncStorage)]

crates/salsa/tests/on_demand_inputs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//! via a b query with zero inputs, which uses `add_synthetic_read` to
55
//! tweak durability and `invalidate` to clear the input.
66
7+
#![allow(clippy::disallowed_types, clippy::type_complexity)]
8+
79
use std::{cell::RefCell, collections::HashMap, rc::Rc};
810

911
use salsa::{Database as _, Durability, EventKind};
@@ -40,8 +42,6 @@ struct Database {
4042

4143
impl salsa::Database for Database {
4244
fn salsa_event(&self, event: salsa::Event) {
43-
dbg!(event.debug(self));
44-
4545
if let Some(cb) = &self.on_event {
4646
cb(self, event)
4747
}
@@ -111,7 +111,6 @@ fn on_demand_input_durability() {
111111
}
112112
"#]].assert_debug_eq(&events);
113113

114-
eprintln!("------------------");
115114
db.salsa_runtime_mut().synthetic_write(Durability::LOW);
116115
events.replace(vec![]);
117116
assert_eq!(db.c(1), 10);
@@ -129,7 +128,6 @@ fn on_demand_input_durability() {
129128
}
130129
"#]].assert_debug_eq(&events);
131130

132-
eprintln!("------------------");
133131
db.salsa_runtime_mut().synthetic_write(Durability::HIGH);
134132
events.replace(vec![]);
135133
assert_eq!(db.c(1), 10);

crates/salsa/tests/parallel/setup.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<T> WithValue<T> for Cell<T> {
4646
fn with_value<R>(&self, value: T, closure: impl FnOnce() -> R) -> R {
4747
let old_value = self.replace(value);
4848

49-
let result = catch_unwind(AssertUnwindSafe(|| closure()));
49+
let result = catch_unwind(AssertUnwindSafe(closure));
5050

5151
self.set(old_value);
5252

@@ -57,18 +57,13 @@ impl<T> WithValue<T> for Cell<T> {
5757
}
5858
}
5959

60-
#[derive(Clone, Copy, PartialEq, Eq)]
60+
#[derive(Default, Clone, Copy, PartialEq, Eq)]
6161
pub(crate) enum CancellationFlag {
62+
#[default]
6263
Down,
6364
Panic,
6465
}
6566

66-
impl Default for CancellationFlag {
67-
fn default() -> CancellationFlag {
68-
CancellationFlag::Down
69-
}
70-
}
71-
7267
/// Various "knobs" that can be used to customize how the queries
7368
/// behave on one specific thread. Note that this state is
7469
/// intentionally thread-local (apart from `signal`).

0 commit comments

Comments
 (0)