Skip to content

Commit

Permalink
[rust toolchain] Removing lifetime reference from closure
Browse files Browse the repository at this point in the history
Github issue: rust-lang/rust#98835
Breakage: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/rust_toolchain.core.x64-release-subbuild/b8806754452009409777/overview

Change-Id: I9b2a76324a3a1e7310066fe87169babaeefb19bc
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/707812
Reviewed-by: Kevin Twidle <[email protected]>
Fuchsia-Auto-Submit: Andrew Pollack <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
  • Loading branch information
andrewpollack authored and CQ Bot committed Aug 8, 2022
1 parent a8be52d commit 4a04e30
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/ui/bin/brightness_manager/src/sensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn open_input_report_device(path: &str) -> Result<InputDeviceProxy, Error> {
Ok(proxy)
}

async fn open_sensor_input_report_reader<'a>() -> Result<AmbientLightInputReportReaderProxy, Error>
async fn open_sensor_input_report_reader() -> Result<AmbientLightInputReportReaderProxy, Error>
{
let input_report_directory = "/dev/class/input-report";
let dir_path = Path::new(input_report_directory);
Expand All @@ -56,12 +56,11 @@ async fn open_sensor_input_report_reader<'a>() -> Result<AmbientLightInputReport
let device_path = device_path.to_str().expect("Bad path");
let device = open_input_report_device(device_path)?;

let get_sensor_input =
|descriptor: &'a DeviceDescriptor| -> Result<&'a Vec<SensorInputDescriptor>, Error> {
let sensor = descriptor.sensor.as_ref().context("device has no sensor")?;
let input_desc = sensor.input.as_ref().context("sensor has no input descriptor")?;
Ok(input_desc)
};
fn get_sensor_input(descriptor: &DeviceDescriptor) -> Result<&Vec<SensorInputDescriptor>, Error> {
let sensor = descriptor.sensor.as_ref().context("device has no sensor")?;
let input_desc = sensor.input.as_ref().context("sensor has no input descriptor")?;
Ok(input_desc)
}

if let Ok(descriptor) = device.get_descriptor().await {
match get_sensor_input(&descriptor) {
Expand Down

0 comments on commit 4a04e30

Please sign in to comment.