summaryrefslogtreecommitdiffstats
path: root/src/conversion.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
commit5485d9655e2ab3a6d04e5f69b246f5db4d2c5936 (patch)
tree84bb1e825656d4c523b65edc5d7780fbb060c8cc /src/conversion.rs
parente4a1ac5a04d021ef026c559354e9913ae59864d8 (diff)
downloadads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.gz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.xz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.zip
Code formatting
Diffstat (limited to 'src/conversion.rs')
-rw-r--r--src/conversion.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/conversion.rs b/src/conversion.rs
index 5e7751c..644ed4a 100644
--- a/src/conversion.rs
+++ b/src/conversion.rs
@@ -1,7 +1,7 @@
-use { ic, private, Error };
+use {ic, private, Error};
#[doc(hidden)]
-pub trait ConvertThreshold<E> : private::Sealed {
+pub trait ConvertThreshold<E>: private::Sealed {
fn convert_threshold(value: i16) -> Result<u16, Error<E>>;
}
@@ -21,7 +21,7 @@ impl<E> ConvertThreshold<E> for ic::Resolution16Bit {
}
#[doc(hidden)]
-pub trait ConvertMeasurement : private::Sealed {
+pub trait ConvertMeasurement: private::Sealed {
fn convert_measurement(register_data: u16) -> i16;
}
@@ -32,8 +32,7 @@ impl ConvertMeasurement for ic::Resolution12Bit {
if is_negative {
let value = 0b1111_0000_0000_0000 | (value >> 4);
value as i16
- }
- else {
+ } else {
(value >> 4) as i16
}
}
@@ -69,7 +68,7 @@ mod tests {
fn assert_invalid_input_data<E>(result: Result<u16, Error<E>>) {
match result {
Err(Error::InvalidInputData) => (),
- _ => panic!("InvalidInputData error was not returned.")
+ _ => panic!("InvalidInputData error was not returned."),
}
}