From 897ee5f3d2fbc7a12bdc70ab1697d3bd5e1c2794 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Wed, 21 Aug 2019 10:13:08 +0200 Subject: [PATCH] cargo fmt --- components/salsa-macros/src/query_group.rs | 4 +--- src/input.rs | 10 +++++----- src/plumbing.rs | 2 +- tests/parallel/cancellation.rs | 4 +--- tests/requires.rs | 8 +++----- tests/transparent.rs | 1 - 6 files changed, 11 insertions(+), 18 deletions(-) diff --git a/components/salsa-macros/src/query_group.rs b/components/salsa-macros/src/query_group.rs index f48ecd7..35f7cf8 100644 --- a/components/salsa-macros/src/query_group.rs +++ b/components/salsa-macros/src/query_group.rs @@ -360,9 +360,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream QueryStorage::Dependencies => quote!(salsa::plumbing::DependencyStorage<#db, Self>), QueryStorage::Input => quote!(salsa::plumbing::InputStorage<#db, Self>), QueryStorage::Interned => quote!(salsa::plumbing::InternedStorage<#db, Self>), - QueryStorage::InternedLookup { intern_query_type } => { - quote!(salsa::plumbing::LookupInternedStorage<#db, Self, #intern_query_type>) - } + QueryStorage::InternedLookup { intern_query_type } => quote!(salsa::plumbing::LookupInternedStorage<#db, Self, #intern_query_type>), QueryStorage::Transparent => continue, }; let keys = &query.keys; diff --git a/src/input.rs b/src/input.rs index 1588498..ed2fcb0 100644 --- a/src/input.rs +++ b/src/input.rs @@ -75,9 +75,9 @@ where DB: Database, { fn try_fetch(&self, db: &DB, key: &Q::Key) -> Result> { - let slot = self.slot(key).unwrap_or_else(|| { - panic!("no value set for {:?}({:?})", Q::default(), key) - }); + let slot = self + .slot(key) + .unwrap_or_else(|| panic!("no value set for {:?}({:?})", Q::default(), key)); let StampedValue { value, @@ -95,7 +95,7 @@ where match self.slot(key) { Some(slot) => slot.stamped_value.read().durability, None => panic!("no value set for {:?}({:?})", Q::default(), key), - } + } } fn entries(&self, _db: &DB) -> C @@ -184,7 +184,7 @@ where let mut slot_stamped_value = entry.get().stamped_value.write(); guard.mark_durability_as_changed(slot_stamped_value.durability); *slot_stamped_value = stamped_value; - } + } Entry::Vacant(entry) => { entry.insert(Arc::new(Slot { diff --git a/src/plumbing.rs b/src/plumbing.rs index c6f8ae8..b18c239 100644 --- a/src/plumbing.rs +++ b/src/plumbing.rs @@ -1,8 +1,8 @@ #![allow(missing_docs)] use crate::debug::TableEntry; -use crate::CycleError; use crate::durability::Durability; +use crate::CycleError; use crate::Database; use crate::Query; use crate::QueryTable; diff --git a/tests/parallel/cancellation.rs b/tests/parallel/cancellation.rs index 2e45f74..2cfe6bb 100644 --- a/tests/parallel/cancellation.rs +++ b/tests/parallel/cancellation.rs @@ -1,6 +1,4 @@ -use crate::setup::{ - CancelationFlag, Canceled, Knobs, ParDatabase, ParDatabaseImpl, WithValue, -}; +use crate::setup::{CancelationFlag, Canceled, Knobs, ParDatabase, ParDatabaseImpl, WithValue}; use salsa::ParallelDatabase; macro_rules! assert_canceled { diff --git a/tests/requires.rs b/tests/requires.rs index ea4502a..2737aba 100644 --- a/tests/requires.rs +++ b/tests/requires.rs @@ -1,7 +1,6 @@ //! Test `salsa::requires` attribute for private query dependencies //! https://github.com/salsa-rs/salsa-rfcs/pull/3 - mod queries { #[salsa::query_group(InputGroupStorage)] pub trait InputGroup { @@ -14,7 +13,7 @@ mod queries { fn private_a(&self, x: u32) -> u32; } - fn private_a(db: &impl PrivGroupA, x: u32) -> u32{ + fn private_a(db: &impl PrivGroupA, x: u32) -> u32 { db.input(x) } @@ -23,7 +22,7 @@ mod queries { fn private_b(&self, x: u32) -> u32; } - fn private_b(db: &impl PrivGroupB, x: u32) -> u32{ + fn private_b(db: &impl PrivGroupB, x: u32) -> u32 { db.input(x) } @@ -34,7 +33,6 @@ mod queries { fn public(&self, x: u32) -> u32; } - fn public(db: &(impl PubGroup + PrivGroupA + PrivGroupB), x: u32) -> u32 { db.private_a(x) + db.private_b(x) } @@ -44,7 +42,7 @@ mod queries { queries::InputGroupStorage, queries::PrivGroupAStorage, queries::PrivGroupBStorage, - queries::PubGroupStorage, + queries::PubGroupStorage )] #[derive(Default)] struct Database { diff --git a/tests/transparent.rs b/tests/transparent.rs index 025ec03..d9e342b 100644 --- a/tests/transparent.rs +++ b/tests/transparent.rs @@ -17,7 +17,6 @@ fn get(db: &impl QueryGroup, x: u32) -> u32 { db.wrap(x) } - #[salsa::database(QueryGroupStorage)] #[derive(Default)] struct Database {