OHOS: Fixed some clippy lints (#37510)

Fixed some clippy lints which were in the OHOS code.

Testing: Normal testcases apply and changes are trivial.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-06-17 16:09:37 +02:00 committed by GitHub
parent f29eee5356
commit 6159a11905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View file

@ -307,7 +307,7 @@ impl FontList {
fn detect_installed_font_families() -> Vec<FontFamily> {
let mut families = enumerate_font_files()
.inspect_err(|e| error!("Failed to enumerate font files due to `{e:?}`"))
.map(|font_files| parse_font_filenames(font_files))
.map(parse_font_filenames)
.unwrap_or_else(|_| FontList::fallback_font_families());
families.extend(Self::hardcoded_font_families());
families

View file

@ -173,7 +173,7 @@ impl ServoAction {
x,
y,
pointer_id,
} => Self::dispatch_touch_event(&servo, *kind, *x, *y, *pointer_id),
} => Self::dispatch_touch_event(servo, *kind, *x, *y, *pointer_id),
KeyUp(k) => servo.key_up(k.clone()),
KeyDown(k) => servo.key_down(k.clone()),
InsertText(text) => servo.ime_insert_text(text.clone()),
@ -205,7 +205,7 @@ impl ServoAction {
if let Some(native_webview_components) =
NATIVE_WEBVIEWS.lock().unwrap().get(*arkts_id as usize)
{
if (servo.active_webview().id() != native_webview_components.id) {
if servo.active_webview().id() != native_webview_components.id {
servo.focus_webview(native_webview_components.id);
servo.pause_compositor();
let (window_handle, _, coordinates) = simpleservo::get_raw_window_handle(
@ -239,7 +239,7 @@ impl ServoAction {
.lock()
.unwrap()
.push(NativeWebViewComponents {
id: id,
id,
xcomponent: xcomponent.clone(),
window: window.clone(),
});
@ -289,7 +289,7 @@ extern "C" fn on_surface_created_cb(xcomponent: *mut OH_NativeXComponent, window
let xc_wrapper = XComponentWrapper(xcomponent);
let window_wrapper = WindowWrapper(window);
if !SERVO_CHANNEL.get().is_some() {
if SERVO_CHANNEL.get().is_none() {
// Todo: Perhaps it would be better to move this thread into the vsync signal thread.
// This would allow us to save one thread and the IPC for the vsync signal.
//
@ -526,7 +526,7 @@ fn initialize_logging_once() {
ONCE.call_once(|| {
let logger: &'static hilog::Logger = &LOGGER;
let max_level = logger.filter();
let r = log::set_logger(logger).and_then(|()| Ok(log::set_max_level(max_level)));
let r = log::set_logger(logger).map(|()| log::set_max_level(max_level));
debug!("Attempted to register the logger: {r:?} and set max level to: {max_level}");
info!("Servo Register callback called!");

View file

@ -2,7 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::cell::RefCell;
use std::ffi::{CString, c_char};
use std::fs;
use std::os::raw::c_void;
use std::path::PathBuf;
@ -10,7 +9,7 @@ use std::ptr::NonNull;
use std::rc::Rc;
use dpi::PhysicalSize;
use log::{debug, error, info, warn};
use log::{debug, info, warn};
use ohos_abilitykit_sys::runtime::application_context;
use ohos_window_manager_sys::display_manager;
use raw_window_handle::{