Skip to content

Commit a9557de

Browse files
committed
Appease clippy
1 parent e0b54c6 commit a9557de

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

modules/benchmarks/src/ia_loop.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub fn update_position_all(ctx: &ReducerContext, expected: u32) {
193193
pub fn update_position_with_velocity(ctx: &ReducerContext, expected: u32) {
194194
let mut count = 0;
195195
for velocity in ctx.db.velocity().iter() {
196-
let Some(mut position) = ctx.db.position().entity_id().find(&velocity.entity_id) else {
196+
let Some(mut position) = ctx.db.position().entity_id().find(velocity.entity_id) else {
197197
continue;
198198
};
199199

@@ -274,7 +274,7 @@ fn get_targetables_near_quad(ctx: &ReducerContext, entity_id: u64, num_players:
274274
ctx.db
275275
.game_targetable_state()
276276
.entity_id()
277-
.find(&t.entity_id)
277+
.find(t.entity_id)
278278
.expect("Identity not found"),
279279
)
280280
}
@@ -296,7 +296,7 @@ fn move_agent(
296296
.db
297297
.game_enemy_state()
298298
.entity_id()
299-
.find(&entity_id)
299+
.find(entity_id)
300300
.expect("GameEnemyState Entity ID not found")
301301
.clone();
302302
ctx.db.game_enemy_state().entity_id().update(enemy);
@@ -314,7 +314,7 @@ fn move_agent(
314314
.db
315315
.game_targetable_state()
316316
.entity_id()
317-
.find(&entity_id)
317+
.find(entity_id)
318318
.expect("GameTargetableState Entity ID not found");
319319
let new_hash = calculate_hash(&targetable.quad) as i64;
320320
targetable.quad = new_hash;
@@ -326,7 +326,7 @@ fn move_agent(
326326
.db
327327
.game_live_targetable_state()
328328
.entity_id()
329-
.find(&entity_id)
329+
.find(entity_id)
330330
.is_some()
331331
{
332332
ctx.db
@@ -341,7 +341,7 @@ fn move_agent(
341341
.db
342342
.game_mobile_entity_state()
343343
.entity_id()
344-
.find(&entity_id)
344+
.find(entity_id)
345345
.expect("GameMobileEntityState Entity ID not found");
346346
let mobile_entity = GameMobileEntityState {
347347
entity_id,
@@ -367,20 +367,20 @@ fn agent_loop(
367367
.db
368368
.game_mobile_entity_state()
369369
.entity_id()
370-
.find(&entity_id)
370+
.find(entity_id)
371371
.expect("GameMobileEntityState Entity ID not found");
372372

373373
let agent_entity = ctx
374374
.db
375375
.game_enemy_state()
376376
.entity_id()
377-
.find(&entity_id)
377+
.find(entity_id)
378378
.expect("GameEnemyState Entity ID not found");
379379
let agent_herd = ctx
380380
.db
381381
.game_herd_cache()
382382
.id()
383-
.find(&agent_entity.herd_id)
383+
.find(agent_entity.herd_id)
384384
.expect("GameHerdCache Entity ID not found");
385385
let agent_herd_coordinates = agent_herd.location;
386386

@@ -402,7 +402,7 @@ pub fn game_loop_enemy_ia(ctx: &ReducerContext, players: u64) {
402402
.db
403403
.game_targetable_state()
404404
.entity_id()
405-
.find(&agent.entity_id)
405+
.find(agent.entity_id)
406406
.expect("No TargetableState for AgentState entity");
407407

408408
let surrounding_agents = get_targetables_near_quad(ctx, agent_targetable.entity_id, players);

modules/benchmarks/src/synthetic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub fn iterate_unique_0_u32_u64_u64(ctx: &ReducerContext) {
219219

220220
#[spacetimedb::reducer]
221221
pub fn filter_unique_0_u32_u64_str_by_id(ctx: &ReducerContext, id: u32) {
222-
if let Some(p) = ctx.db.unique_0_u32_u64_str().id().find(&id) {
222+
if let Some(p) = ctx.db.unique_0_u32_u64_str().id().find(id) {
223223
black_box(p);
224224
}
225225
}
@@ -261,7 +261,7 @@ pub fn filter_btree_each_column_u32_u64_str_by_name(ctx: &ReducerContext, name:
261261

262262
#[spacetimedb::reducer]
263263
pub fn filter_unique_0_u32_u64_u64_by_id(ctx: &ReducerContext, id: u32) {
264-
if let Some(loc) = ctx.db.unique_0_u32_u64_u64().id().find(&id) {
264+
if let Some(loc) = ctx.db.unique_0_u32_u64_u64().id().find(id) {
265265
black_box(loc);
266266
}
267267
}
@@ -328,12 +328,12 @@ pub fn filter_btree_each_column_u32_u64_u64_by_y(ctx: &ReducerContext, x: u64) {
328328

329329
#[spacetimedb::reducer]
330330
pub fn delete_unique_0_u32_u64_str_by_id(ctx: &ReducerContext, id: u32) {
331-
ctx.db.unique_0_u32_u64_str().id().delete(&id);
331+
ctx.db.unique_0_u32_u64_str().id().delete(id);
332332
}
333333

334334
#[spacetimedb::reducer]
335335
pub fn delete_unique_0_u32_u64_u64_by_id(ctx: &ReducerContext, id: u32) {
336-
ctx.db.unique_0_u32_u64_u64().id().delete(&id);
336+
ctx.db.unique_0_u32_u64_u64().id().delete(id);
337337
}
338338

339339
// ---------- clear table ----------

modules/perf-test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const CHUNK: u64 = ID / ROWS_PER_CHUNK;
4343
/// Probing a single column index for a single row should be fast!
4444
pub fn test_index_scan_on_id(ctx: &ReducerContext) {
4545
let span = LogStopwatch::new("Index scan on {id}");
46-
let location = ctx.db.location().id().find(&ID).unwrap();
46+
let location = ctx.db.location().id().find(ID).unwrap();
4747
span.end();
4848
assert_eq!(ID, location.id);
4949
}

modules/quickstart-chat/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn validate_name(name: String) -> Result<String, String> {
2626
#[spacetimedb::reducer]
2727
pub fn set_name(ctx: &ReducerContext, name: String) -> Result<(), String> {
2828
let name = validate_name(name)?;
29-
if let Some(user) = ctx.db.user().identity().find(&ctx.sender) {
29+
if let Some(user) = ctx.db.user().identity().find(ctx.sender) {
3030
ctx.db.user().identity().update(User {
3131
name: Some(name),
3232
..user
@@ -65,7 +65,7 @@ pub fn init(_ctx: &ReducerContext) {}
6565

6666
#[spacetimedb::reducer(client_connected)]
6767
pub fn identity_connected(ctx: &ReducerContext) {
68-
if let Some(user) = ctx.db.user().identity().find(&ctx.sender) {
68+
if let Some(user) = ctx.db.user().identity().find(ctx.sender) {
6969
// If this is a returning user, i.e. we already have a `User` with this `Identity`,
7070
// set `online: true`, but leave `name` and `identity` unchanged.
7171
ctx.db.user().identity().update(User { online: true, ..user });
@@ -82,7 +82,7 @@ pub fn identity_connected(ctx: &ReducerContext) {
8282

8383
#[spacetimedb::reducer(client_disconnected)]
8484
pub fn identity_disconnected(ctx: &ReducerContext) {
85-
if let Some(user) = ctx.db.user().identity().find(&ctx.sender) {
85+
if let Some(user) = ctx.db.user().identity().find(ctx.sender) {
8686
ctx.db.user().identity().update(User { online: false, ..user });
8787
} else {
8888
// This branch should be unreachable,

0 commit comments

Comments
 (0)