Switch from `.try_into().unwrap()` to `as _`
The latest Rust 1.75.0 clippy detected the following:
```
error: use of a fallible conversion when an infallible one could be used
--> system/librustutils/system_properties.rs:295:42
|
295 | tv_nsec: duration.subsec_nanos().try_into().unwrap(),
| ^^^^^^^^^^^^^^^^^^^ help:
use: `into()`
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
= note: `-D clippy::unnecessary-fallible-conversions` implied by `-D
warnings`
= help: to override `-D warnings` add
`#[allow(clippy::unnecessary_fallible_conversions)]`
error: aborting due to previous error
```
The duration is guaranteed to have a representable nanos component, so
just casting to the expected type (which ends up eventually as `c_long`)
is sufficient.
Bug: http://b/321303117
Test: toolchain/android_rust/test_compiler.py --prebuilt-path dist/rust-dev.tar.xz --target aosp_cf_x86_64_phone --all-rust
Change-Id: I1e29eed0e0ea8f18f087ef4d7ac2e3047af95eb4
1 file changed