Zero warnings on Windows and Linux, clippy included (W-02, L-02)
rustc and clippy are clean for the whole workspace, every target, on both. clippy --fix moved test modules last and took the shorter forms; long types got named aliases; ElyTree's form takes its title and button words as one pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c96d39a342
commit
9c9f9ab8f9
26 files changed
+73
-60
No files matched your search
@@ -273,19 +273,6 @@ pub fn outward(uri: &str) -> bool {
|
||||
.any(|scheme| uri.get(..scheme.len()).is_some_and(|head| head.eq_ignore_ascii_case(scheme)))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod outward_tests {
|
||||
#[test]
|
||||
fn web_and_mail_go_out_in_any_case() {
|
||||
for uri in ["https://a.example/", "HTTPS://a.example/", "Http://a.example/", "MAILTO:x@a.example"] {
|
||||
assert!(super::outward(uri), "{uri}");
|
||||
}
|
||||
for uri in ["ftp://a.example/", "file:///etc/passwd", "javascript:alert(1)", "httpsx://a", "ht", "\u{e9}https://"] {
|
||||
assert!(!super::outward(uri), "{uri}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A localized message.
|
||||
pub fn text(cx: &App, key: &str, args: &[(&str, &str)]) -> SharedString {
|
||||
ely_ui::i18n::text(cx, key, args)
|
||||
@@ -402,3 +389,16 @@ pub trait Tabs: Host {
|
||||
}
|
||||
|
||||
impl<H: Host> Tabs for H {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod outward_tests {
|
||||
#[test]
|
||||
fn web_and_mail_go_out_in_any_case() {
|
||||
for uri in ["https://a.example/", "HTTPS://a.example/", "Http://a.example/", "MAILTO:x@a.example"] {
|
||||
assert!(super::outward(uri), "{uri}");
|
||||
}
|
||||
for uri in ["ftp://a.example/", "file:///etc/passwd", "javascript:alert(1)", "httpsx://a", "ht", "\u{e9}https://"] {
|
||||
assert!(!super::outward(uri), "{uri}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,11 +205,12 @@ fn big_png(path: &Path, side: u32) {
|
||||
let mut raw = Vec::new();
|
||||
let mut seed = 7u32;
|
||||
for _ in 0..side {
|
||||
raw.push(0);
|
||||
for _ in 0..side * 3 {
|
||||
// Each row: filter byte none, then its noise.
|
||||
let noise = (0..side * 3).map(|_| {
|
||||
seed = seed.wrapping_mul(1_103_515_245).wrapping_add(12_345);
|
||||
raw.push((seed >> 16) as u8);
|
||||
}
|
||||
(seed >> 16) as u8
|
||||
});
|
||||
raw.extend(std::iter::once(0).chain(noise));
|
||||
}
|
||||
// zlib with stored blocks; Adler-32 at the end.
|
||||
let mut zlib = vec![0x78, 0x01];
|
||||
@@ -246,7 +247,7 @@ fn a_failed_open_keeps_no_memory() {
|
||||
};
|
||||
// MuPDF's 256 MB store fills first; then nothing grows.
|
||||
for _ in 0..70 {
|
||||
let refused = worker.open(&png).err().expect("not a PDF");
|
||||
let refused = worker.open(&png).expect_err("not a PDF");
|
||||
assert!(refused.to_string().contains("not a PDF"), "{refused}");
|
||||
}
|
||||
let before = rss(worker.pid());
|
||||
|
||||
@@ -26,7 +26,7 @@ fn platform() -> String {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn platform() -> String {
|
||||
resolve_env(|key| env::value(key))
|
||||
resolve_env(env::value)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
|
||||
@@ -155,8 +155,11 @@ pub fn install_as(locale: &'static str, cx: &mut App) {
|
||||
);
|
||||
}
|
||||
|
||||
/// Keys and messages of one language.
|
||||
type Catalog = Vec<(&'static str, &'static str)>;
|
||||
|
||||
/// The English and Chinese catalogs, every module's messages.
|
||||
fn catalogs() -> (Vec<(&'static str, &'static str)>, Vec<(&'static str, &'static str)>) {
|
||||
fn catalogs() -> (Catalog, Catalog) {
|
||||
let en: Vec<_> = EN
|
||||
.iter()
|
||||
.chain(office::EN)
|
||||
|
||||
@@ -18,10 +18,13 @@ use gpui::{AnyElement, App, Context, IntoElement, SharedString, WeakEntity};
|
||||
use super::window::SettingsView;
|
||||
use crate::i18n::text;
|
||||
|
||||
/// Each kind's size, and whether a clear waits.
|
||||
type Usage = Vec<(Kind, u64, bool)>;
|
||||
|
||||
/// Last read sizes and limits; a clear waiting or failed.
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Storage {
|
||||
usage: Option<Result<Vec<(Kind, u64, bool)>, SharedString>>,
|
||||
usage: Option<Result<Usage, SharedString>>,
|
||||
limits: Option<Result<Limits, SharedString>>,
|
||||
/// A clear waiting for the user's yes.
|
||||
confirming: Option<Kind>,
|
||||
|
||||
@@ -179,7 +179,7 @@ impl Probe {
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(500))
|
||||
.await;
|
||||
let _ = view.update(cx, |view, _| view.run_js("report('edited')"));
|
||||
view.update(cx, |view, _| view.run_js("report('edited')"));
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ pub fn start(data: &Path, cx: &mut App) -> Result<()> {
|
||||
let why = held(&cache).unwrap_or_else(|| "CEF did not initialize".into());
|
||||
log::error!("web: {why}");
|
||||
*FAILED.lock().expect("the start lock") = Some(why);
|
||||
cx.update(|cx| crate::view::deliver(cx));
|
||||
cx.update(crate::view::deliver);
|
||||
return;
|
||||
}
|
||||
log::info!("web: CEF started, cache {}", cache.display());
|
||||
@@ -310,7 +310,7 @@ pub fn start(data: &Path, cx: &mut App) -> Result<()> {
|
||||
run_later();
|
||||
make_browsers();
|
||||
do_message_loop_work();
|
||||
cx.update(|cx| crate::view::deliver(cx));
|
||||
cx.update(crate::view::deliver);
|
||||
// As cefclient: CEF does not ask for all work.
|
||||
due = Some(FALLBACK);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ wrap_load_handler! {
|
||||
failed_url: Option<&CefString>,
|
||||
) {
|
||||
// A stopped load is no failure; a fenced one is.
|
||||
if !frame.is_some_and(|frame| frame.is_main() == 1) || error_code == Errorcode::ABORTED {
|
||||
if frame.is_none_or(|frame| frame.is_main() != 1) || error_code == Errorcode::ABORTED {
|
||||
return;
|
||||
}
|
||||
let text = error_text.map(CefString::to_string).unwrap_or_default();
|
||||
|
||||
@@ -64,9 +64,12 @@ pub struct WebView {
|
||||
/// Shown instead of the page until reloaded.
|
||||
fault: Option<String>,
|
||||
/// Takes a paste before the page; true when it did.
|
||||
pub(crate) paste: Option<std::rc::Rc<dyn Fn(&mut Window, &mut App) -> bool>>,
|
||||
pub(crate) paste: Option<Paste>,
|
||||
}
|
||||
|
||||
/// Takes a paste before the page; true when it did.
|
||||
pub(crate) type Paste = std::rc::Rc<dyn Fn(&mut Window, &mut App) -> bool>;
|
||||
|
||||
impl EventEmitter<Event> for WebView {}
|
||||
|
||||
impl Focusable for WebView {
|
||||
|
||||
Reference in new issue
Block a user