Skip to content

Commit 6f39de6

Browse files
committed
Remove unneeded request method.
1 parent aec3243 commit 6f39de6

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

Diff for: src/cdev_pin.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,6 @@ impl CdevPin<Output> {
121121
}
122122

123123
impl<MODE> CdevPin<MODE> {
124-
#[inline]
125-
fn request(&self) -> &Request {
126-
#[cfg(not(feature = "async-tokio"))]
127-
{
128-
&self.req
129-
}
130-
131-
#[cfg(feature = "async-tokio")]
132-
{
133-
self.req.as_ref()
134-
}
135-
}
136-
137124
/// Converts a pin state to a value, depending on
138125
/// whether the pin is configured as active-low.
139126
fn state_to_value(&self, state: PinState) -> Value {
@@ -189,20 +176,20 @@ impl<MODE> ErrorType for CdevPin<MODE> {
189176
impl InputPin for CdevPin<Input> {
190177
fn is_low(&mut self) -> Result<bool, Self::Error> {
191178
let low_value = self.state_to_value(PinState::Low);
192-
Ok(self.request().value(self.line)? == low_value)
179+
Ok(self.req.as_ref().value(self.line)? == low_value)
193180
}
194181

195182
fn is_high(&mut self) -> Result<bool, Self::Error> {
196183
let high_value = self.state_to_value(PinState::High);
197-
Ok(self.request().value(self.line)? == high_value)
184+
Ok(self.req.as_ref().value(self.line)? == high_value)
198185
}
199186
}
200187

201188
impl OutputPin for CdevPin<Output> {
202189
fn set_low(&mut self) -> Result<(), Self::Error> {
203190
let new_value = self.state_to_value(PinState::Low);
204191

205-
self.request().set_value(self.line, new_value)?;
192+
self.req.as_ref().set_value(self.line, new_value)?;
206193
self.line_config.value = Some(new_value);
207194

208195
Ok(())
@@ -211,7 +198,7 @@ impl OutputPin for CdevPin<Output> {
211198
fn set_high(&mut self) -> Result<(), Self::Error> {
212199
let new_value = self.state_to_value(PinState::High);
213200

214-
self.request().set_value(self.line, new_value)?;
201+
self.req.as_ref().set_value(self.line, new_value)?;
215202
self.line_config.value = Some(new_value);
216203

217204
Ok(())

0 commit comments

Comments
 (0)