Skip to content

Commit e339c65

Browse files
committed
Remove dev-dependency insta
1 parent def5a1d commit e339c65

24 files changed

+188
-310
lines changed

Cargo.lock

Lines changed: 3 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/salsa/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ salsa-macros = { version = "0.0.0", path = "salsa-macros" }
2828
diff = "0.1.13"
2929
linked-hash-map = "0.5.6"
3030
rand = "0.8.5"
31-
rand_distr = "0.4.3"
3231
test-log = "0.2.14"
33-
insta = "1.18.0"
32+
expect-test = "1.4.0"

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//!
12
use heck::ToSnakeCase;
23
use proc_macro::TokenStream;
34
use syn::parse::{Parse, ParseStream};
@@ -113,10 +114,8 @@ pub(crate) fn database(args: TokenStream, input: TokenStream) -> TokenStream {
113114
let mut maybe_changed_ops = proc_macro2::TokenStream::new();
114115
let mut cycle_recovery_strategy_ops = proc_macro2::TokenStream::new();
115116
let mut for_each_ops = proc_macro2::TokenStream::new();
116-
for ((QueryGroup { group_path }, group_storage), group_index) in query_groups
117-
.iter()
118-
.zip(&query_group_storage_names)
119-
.zip(0_u16..)
117+
for ((QueryGroup { group_path }, group_storage), group_index) in
118+
query_groups.iter().zip(&query_group_storage_names).zip(0_u16..)
120119
{
121120
fmt_ops.extend(quote! {
122121
#group_index => {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//!
12
pub(crate) struct Parenthesized<T>(pub(crate) T);
23

34
impl<T> syn::parse::Parse for Parenthesized<T>

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

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//!
12
use std::{convert::TryFrom, iter::FromIterator};
23

34
use crate::parenthesized::Parenthesized;
@@ -20,12 +21,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
2021
let input_span = input.span();
2122
let (trait_attrs, salsa_attrs) = filter_attrs(input.attrs);
2223
if !salsa_attrs.is_empty() {
23-
return Error::new(
24-
input_span,
25-
format!("unsupported attributes: {:?}", salsa_attrs),
26-
)
27-
.to_compile_error()
28-
.into();
24+
return Error::new(input_span, format!("unsupported attributes: {:?}", salsa_attrs))
25+
.to_compile_error()
26+
.into();
2927
}
3028

3129
let trait_vis = input.vis;
@@ -43,7 +41,8 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
4341
let mut cycle = None;
4442
let mut invoke = None;
4543

46-
let mut query_type = format_ident!("{}Query", query_name.to_string().to_upper_camel_case());
44+
let mut query_type =
45+
format_ident!("{}Query", query_name.to_string().to_upper_camel_case());
4746
let mut num_storages = 0;
4847

4948
// Extract attributes.
@@ -175,9 +174,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
175174
fn_name: lookup_fn_name,
176175
receiver: self_receiver.clone(),
177176
attrs: vec![], // FIXME -- some automatically generated docs on this method?
178-
storage: QueryStorage::InternedLookup {
179-
intern_query_type: query_type.clone(),
180-
},
177+
storage: QueryStorage::InternedLookup { intern_query_type: query_type.clone() },
181178
keys: lookup_keys,
182179
value: lookup_value,
183180
invoke: None,
@@ -211,9 +208,9 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
211208
let mut storage_fields = proc_macro2::TokenStream::new();
212209
let mut queries_with_storage = vec![];
213210
for query in &queries {
214-
#[allow(clippy::map_identity)] // clippy is incorrect here, this is not the identity function due to match ergonomics
215-
let (key_names, keys): (Vec<_>, Vec<_>) =
216-
query.keys.iter().map(|(a, b)| (a, b)).unzip();
211+
#[allow(clippy::map_identity)]
212+
// clippy is incorrect here, this is not the identity function due to match ergonomics
213+
let (key_names, keys): (Vec<_>, Vec<_>) = query.keys.iter().map(|(a, b)| (a, b)).unzip();
217214
let value = &query.value;
218215
let fn_name = &query.fn_name;
219216
let qt = &query.query_type;
@@ -361,11 +358,8 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
361358
}
362359
});
363360

364-
let non_transparent_queries = || {
365-
queries
366-
.iter()
367-
.filter(|q| !matches!(q.storage, QueryStorage::Transparent))
368-
};
361+
let non_transparent_queries =
362+
|| queries.iter().filter(|q| !matches!(q.storage, QueryStorage::Transparent));
369363

370364
// Emit the query types.
371365
for (query, query_index) in non_transparent_queries().zip(0_u16..) {
@@ -681,11 +675,7 @@ impl TryFrom<syn::Attribute> for SalsaAttr {
681675
}
682676

683677
fn is_not_salsa_attr_path(path: &syn::Path) -> bool {
684-
path.segments
685-
.first()
686-
.map(|s| s.ident != "salsa")
687-
.unwrap_or(true)
688-
|| path.segments.len() != 2
678+
path.segments.first().map(|s| s.ident != "salsa").unwrap_or(true) || path.segments.len() != 2
689679
}
690680

691681
fn filter_attrs(attrs: Vec<Attribute>) -> (Vec<Attribute>, Vec<SalsaAttr>) {

0 commit comments

Comments
 (0)