Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4015ee7

Browse files
authored
Merge pull request #3676 from tock/clippy-D-bool_comparison
clippy: -D clippy::bool_comparison
2 parents cfa4bf5 + 1ef3e38 commit 4015ee7

File tree

28 files changed

+39
-40
lines changed

28 files changed

+39
-40
lines changed

capsules/core/src/adc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<'a> AdcVirtualized<'a> {
669669
match self
670670
.apps
671671
.enter(processid, |app, _| {
672-
if app.pending_command == true {
672+
if app.pending_command {
673673
Err(ErrorCode::BUSY)
674674
} else {
675675
app.pending_command = true;

capsules/core/src/rng.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl rng::Client for RngDriver<'_> {
157157
// Check if done switched to false. If it did, then that app
158158
// didn't get enough random, so there's no way there is more for
159159
// other apps.
160-
if done == false {
160+
if !done {
161161
break;
162162
}
163163
}

capsules/core/src/virtualizers/virtual_alarm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<'a, A: Alarm<'a>> Alarm<'a> for VirtualMuxAlarm<'a, A> {
151151
if enabled == 0 {
152152
//debug!("virtual_alarm: first alarm: set it.");
153153
self.mux.set_alarm(reference, dt);
154-
} else if self.mux.firing.get() == false {
154+
} else if !self.mux.firing.get() {
155155
// If firing is true, the mux will scan all the alarms after
156156
// firing and pick the soonest one so do not need to modify the
157157
// mux. Otherwise, this is an alarm

capsules/extra/src/app_flash_driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'a> AppFlash<'a> {
134134
.unwrap_or(Err(ErrorCode::RESERVE))
135135
} else {
136136
// Queue this request for later.
137-
if app.pending_command == true {
137+
if app.pending_command {
138138
Err(ErrorCode::NOMEM)
139139
} else {
140140
app.pending_command = true;

capsules/extra/src/fxos8700cq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl I2CClient for Fxos8700cq<'_> {
313313
}
314314
}
315315
State::ReadAccelWait => {
316-
if self.interrupt_pin1.read() == false {
316+
if !self.interrupt_pin1.read() {
317317
// Sample is already ready.
318318
self.interrupt_pin1.disable_interrupts();
319319
buffer[0] = Registers::OutXMsb as u8;

capsules/extra/src/ninedof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a> NineDof<'a> {
9393
}
9494
CommandReturn::from(value)
9595
} else {
96-
if app.pending_command == true {
96+
if app.pending_command {
9797
CommandReturn::failure(ErrorCode::BUSY)
9898
} else {
9999
app.pending_command = true;

capsules/extra/src/nonvolatile_storage_driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a> NonvolatileStorage<'a> {
303303
self.userspace_call_driver(command, offset, active_len)
304304
} else {
305305
// Some app is using the storage, we must wait.
306-
if app.pending_command == true {
306+
if app.pending_command {
307307
// No more room in the queue, nowhere to store this
308308
// request.
309309
Err(ErrorCode::NOMEM)
@@ -341,7 +341,7 @@ impl<'a> NonvolatileStorage<'a> {
341341
_ => Err(ErrorCode::FAIL),
342342
}
343343
} else {
344-
if self.kernel_pending_command.get() == true {
344+
if self.kernel_pending_command.get() {
345345
Err(ErrorCode::NOMEM)
346346
} else {
347347
self.kernel_pending_command.set(true);

capsules/extra/src/rf233.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ impl<'a, S: spi::SpiMasterDevice<'a>> RF233<'a, S> {
10781078
// packet from being overwritten before reading it from the radio,
10791079
// the driver needs to disable reception. This has to be done in the first
10801080
// SPI operation.
1081-
if self.spi_busy.get() == false {
1081+
if !self.spi_busy.get() {
10821082
if self.state.get() == InternalState::RX {
10831083
// We've received a complete frame; need to disable
10841084
// reception until we've read it out from RAM,

capsules/extra/src/screen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'a> Screen<'a> {
143143
match self
144144
.apps
145145
.enter(process_id, |app, _| {
146-
if app.pending_command == true {
146+
if app.pending_command {
147147
CommandReturn::failure(ErrorCode::BUSY)
148148
} else {
149149
app.pending_command = true;

capsules/extra/src/sdcard.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ impl<'a, A: hil::time::Alarm<'a>> SDCard<'a, A> {
12461246
// if there is no detect pin, assume an sd card is installed
12471247
self.detect_pin.get().map_or(true, |pin| {
12481248
// sd card detection pin is active low
1249-
pin.read() == false
1249+
!pin.read()
12501250
})
12511251
}
12521252

0 commit comments

Comments
 (0)