Skip to content

Commit

Permalink
Merge pull request #281 from redbadger/must_use
Browse files Browse the repository at this point in the history
must_use on app.update()
  • Loading branch information
StuartHarris authored Oct 21, 2024
2 parents 45adf89 + 9c75a14 commit b56e6d5
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 100 deletions.
8 changes: 4 additions & 4 deletions examples/bridge_echo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions examples/bridge_echo/shared/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ mod test {
let app = AppTester::<App, _>::default();
let mut model = Model::default();

app.update(Event::Tick, &mut model);
app.update(Event::Tick, &mut model);
app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);

let actual_view = app.view(&model);
let expected_view = ViewModel { count: 3 };
Expand All @@ -91,14 +91,14 @@ mod test {
let app = AppTester::<App, _>::default();
let mut model = Model::default();

app.update(Event::Tick, &mut model);
app.update(Event::Tick, &mut model);
app.update(Event::Tick, &mut model);
app.update(Event::NewPeriod, &mut model);
app.update(Event::Tick, &mut model);
app.update(Event::Tick, &mut model);
app.update(Event::NewPeriod, &mut model);
app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::NewPeriod, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::Tick, &mut model);
let _ = app.update(Event::NewPeriod, &mut model);
let _ = app.update(Event::Tick, &mut model);

let expected = Model {
log: vec![3, 2],
Expand Down
25 changes: 13 additions & 12 deletions examples/cat_facts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/cat_facts/shared/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ mod tests {
assert_eq!(update.events, vec![Event::SetFact(Ok(expected_response))]);

for event in update.events {
app.update(event, &mut model);
let _ = app.update(event, &mut model);
}

assert_let!(Effect::Http(request), effects.next().unwrap());
Expand All @@ -288,7 +288,7 @@ mod tests {
.resolve(request, response)
.expect("should resolve successfully");
for event in update.events {
app.update(event, &mut model);
let _ = app.update(event, &mut model);
}

assert_eq!(model.cat_fact, Some(a_fact));
Expand Down
2 changes: 1 addition & 1 deletion examples/cat_facts/shared/src/app/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod tests {
.resolve(request, response)
.expect("should resolve successfully");
for event in update.events {
app.update(event, &mut model);
let _ = app.update(event, &mut model);
}

assert_eq!(model.platform, "platform");
Expand Down
83 changes: 47 additions & 36 deletions examples/counter/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/counter/shared/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ mod tests {
.expect("Update to succeed");

// send the generated (internal) `Set` event back into the app
app.update(update.events[0].clone(), &mut model);
let _ = app.update(update.events[0].clone(), &mut model);

// check that the model has been updated correctly
insta::assert_yaml_snapshot!(model, @r###"
Expand Down Expand Up @@ -319,7 +319,7 @@ mod tests {
// run the event loop in order to send the (internal) `Set` event
// back into the app
for event in update.events {
app.update(event, &mut model);
let _ = app.update(event, &mut model);
}

// check that the model has been updated correctly
Expand Down
Loading

0 comments on commit b56e6d5

Please sign in to comment.