clippy: fix warnings on modules outside components (#31567)

This commit is contained in:
eri 2024-03-08 00:42:39 +01:00 committed by GitHub
parent 3b19189896
commit 6c7fe31db1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 37 additions and 46 deletions

View file

@ -84,11 +84,9 @@ impl App {
// Handle browser state.
let webviews = WebViewManager::new(window.clone());
let initial_url = get_default_url(
url.as_ref().map(String::as_str),
env::current_dir().unwrap(),
|path| fs::metadata(path).is_ok(),
);
let initial_url = get_default_url(url.as_deref(), env::current_dir().unwrap(), |path| {
fs::metadata(path).is_ok()
});
let mut app = App {
event_queue: RefCell::new(vec![]),
@ -270,7 +268,7 @@ impl App {
window.winit_window().unwrap().request_redraw();
},
winit::event::Event::WindowEvent { ref event, .. } => {
let response = minibrowser.on_event(&event);
let response = minibrowser.on_event(event);
if response.repaint {
// Request a winit redraw event, so we can recomposite, update and paint
// the minibrowser, and present the new frame.

View file

@ -28,17 +28,14 @@ pub fn get_default_url(
// If the url is not provided, we fallback to the homepage in prefs,
// or a blank page in case the homepage is not set either.
let mut new_url = None;
let cmdline_url = url_opt
.clone()
.map(|s| s.to_string())
.and_then(|url_string| {
parse_url_or_filename(cwd.as_ref(), &url_string)
.map_err(|error| {
warn!("URL parsing failed ({:?}).", error);
error
})
.ok()
});
let cmdline_url = url_opt.map(|s| s.to_string()).and_then(|url_string| {
parse_url_or_filename(cwd.as_ref(), &url_string)
.map_err(|error| {
warn!("URL parsing failed ({:?}).", error);
error
})
.ok()
});
if let Some(url) = cmdline_url.clone() {
// Check if the URL path corresponds to a file
@ -50,7 +47,7 @@ pub fn get_default_url(
}
}
if new_url.is_none() && !url_opt.is_none() {
if new_url.is_none() && url_opt.is_some() {
new_url = location_bar_input_to_url(url_opt.unwrap());
}

View file

@ -7,7 +7,7 @@ use std::path::Path;
use crate::parser::{get_default_url, location_bar_input_to_url, parse_url_or_filename};
#[cfg(not(target_os = "windows"))]
const FAKE_CWD: &'static str = "/fake/cwd";
const FAKE_CWD: &str = "/fake/cwd";
#[cfg(target_os = "windows")]
const FAKE_CWD: &'static str = "C:/fake/cwd";