Skip to content

Commit 8562824

Browse files
committed
pacify the merciless clippy
1 parent f8b1620 commit 8562824

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/attach.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ impl Attached {
7474
/// Access the "attached" database. Returns `None` if no database is attached.
7575
/// Databases are attached with `attach_database`.
7676
fn with<R>(&self, op: impl FnOnce(&dyn Database) -> R) -> Option<R> {
77-
if let Some(db) = self.database.get() {
78-
// SAFETY: We always attach the database in for the entire duration of a function,
79-
// so it cannot become "unattached" while this function is running.
80-
Some(op(unsafe { db.as_ref() }))
81-
} else {
82-
None
83-
}
77+
let db = self.database.get()?;
78+
79+
// SAFETY: We always attach the database in for the entire duration of a function,
80+
// so it cannot become "unattached" while this function is running.
81+
Some(op(unsafe { db.as_ref() }))
8482
}
8583
}
8684

src/database.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ use crate::{
1212
/// The trait implemented by all Salsa databases.
1313
/// You can create your own subtraits of this trait using the `#[salsa::db]` procedural macro.
1414
///
15-
/// # Safety conditions
15+
/// # Safety
1616
///
1717
/// This trait can only safely be implemented by Salsa's [`DatabaseImpl`][] type.
18-
/// FIXME: Document better the unsafety conditions we guarantee.
18+
///
19+
/// FIXME: Document better the unsafety conditions we require.
1920
#[salsa_macros::db]
2021
pub unsafe trait Database: Send + AsDynDatabase + Any {
2122
/// This function is invoked by the salsa runtime at various points during execution.

src/tracked_struct/struct_map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ where
8080
///
8181
/// * If value with same `value.id` is already present in the map.
8282
/// * If value not created in current revision.
83-
pub fn insert<'db>(&'db self, current_revision: Revision, value: Value<C>) -> C::Struct<'db> {
83+
pub fn insert(&self, current_revision: Revision, value: Value<C>) -> C::Struct<'_> {
8484
assert_eq!(value.created_at, current_revision);
8585

8686
let id = value.id;
@@ -99,7 +99,7 @@ where
9999
unsafe { C::struct_from_raw(pointer) }
100100
}
101101

102-
pub fn validate<'db>(&'db self, current_revision: Revision, id: Id) {
102+
pub fn validate(&self, current_revision: Revision, id: Id) {
103103
let mut data = self.map.get_mut(&id).unwrap();
104104

105105
// UNSAFE: We never permit `&`-access in the current revision until data.created_at
@@ -118,7 +118,7 @@ where
118118
///
119119
/// * If the value is not present in the map.
120120
/// * If the value is already updated in this revision.
121-
pub fn update<'db>(&'db self, current_revision: Revision, id: Id) -> Update<'db, C> {
121+
pub fn update(&self, current_revision: Revision, id: Id) -> Update<'_, C> {
122122
let mut data = self.map.get_mut(&id).unwrap();
123123

124124
// UNSAFE: We never permit `&`-access in the current revision until data.created_at
@@ -163,7 +163,7 @@ where
163163
///
164164
/// * If the value is not present in the map.
165165
/// * If the value has not been updated in this revision.
166-
pub fn get<'db>(&'db self, current_revision: Revision, id: Id) -> C::Struct<'db> {
166+
pub fn get(&self, current_revision: Revision, id: Id) -> C::Struct<'_> {
167167
Self::get_from_map(&self.map, current_revision, id)
168168
}
169169

@@ -173,11 +173,11 @@ where
173173
///
174174
/// * If the value is not present in the map.
175175
/// * If the value has not been updated in this revision.
176-
fn get_from_map<'db>(
177-
map: &'db FxDashMap<Id, Alloc<Value<C>>>,
176+
fn get_from_map(
177+
map: &FxDashMap<Id, Alloc<Value<C>>>,
178178
current_revision: Revision,
179179
id: Id,
180-
) -> C::Struct<'db> {
180+
) -> C::Struct<'_> {
181181
let data = map.get(&id).unwrap();
182182

183183
// UNSAFE: We permit `&`-access in the current revision once data.created_at
@@ -230,7 +230,7 @@ where
230230
///
231231
/// * If the value is not present in the map.
232232
/// * If the value has not been updated in this revision.
233-
pub fn get<'db>(&'db self, current_revision: Revision, id: Id) -> C::Struct<'db> {
233+
pub fn get(&self, current_revision: Revision, id: Id) -> C::Struct<'_> {
234234
StructMap::get_from_map(&self.map, current_revision, id)
235235
}
236236
}

0 commit comments

Comments
 (0)