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
@@ -236,7 +236,8 @@ impl Viewer {
|
||||
}
|
||||
|
||||
fn protect_rows(&self, on: bool, user: &Entity<TextInput>, owner: &Entity<TextInput>, allow: u32, this: &Entity<Self>, cx: &mut Context<Self>) -> AnyElement {
|
||||
let set = |change: Box<dyn Fn(&mut bool, &mut u32, bool)>| {
|
||||
type Change = Box<dyn Fn(&mut bool, &mut u32, bool)>;
|
||||
let set = |change: Change| {
|
||||
let this = this.clone();
|
||||
move |value: bool, _: &mut Window, cx: &mut App| {
|
||||
this.update(cx, |viewer, cx| {
|
||||
|
||||
@@ -57,12 +57,11 @@ impl PdfView {
|
||||
self.off(
|
||||
move |worker| {
|
||||
let fields = worker.signatures(doc, &path)?;
|
||||
Ok(fields.into_iter().map(|field| {
|
||||
Ok(Iterator::collect::<Vec<_>>(fields.into_iter().map(|field| {
|
||||
let chain = field.signed.as_ref().map(|signed| signed.certs.clone()).filter(|certs| !certs.is_empty());
|
||||
let trust = chain.map(|chain| trust::check(&chain).map_err(|error| error.to_string()));
|
||||
Checked { field, trust }
|
||||
}))
|
||||
.map(Iterator::collect::<Vec<_>>)
|
||||
})))
|
||||
},
|
||||
move |view, read: io::Result<Vec<Checked>>, cx| {
|
||||
view.reading_signatures = false;
|
||||
|
||||
@@ -76,7 +76,7 @@ fn a_damaged_file_opens_repaired_and_saves_as_a_new_file() {
|
||||
bytes.truncate(at);
|
||||
bytes.extend_from_slice(b"startxref\n9\n%%EOF\n");
|
||||
std::fs::write(&path, &bytes).expect("writes");
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), &[path.clone()], true);
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), std::slice::from_ref(&path), true);
|
||||
let view = shown(cx, &viewer);
|
||||
assert_eq!(cx.update(|_, app| viewer.read(app).active_tab().and_then(|tab| tab.risk)), Some(ely_office::Risk::Repaired));
|
||||
assert!(cx.update(|_, app| view.read(app).repair.as_ref().is_some_and(|report| !report.is_empty())));
|
||||
@@ -158,7 +158,7 @@ fn a_picture_that_breaks_as_it_draws_stops_an_overwrite() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let (path, bytes) = broken_picture(dir.path(), 792.0, 600.0);
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), &[path.clone()], true);
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), std::slice::from_ref(&path), true);
|
||||
shown(cx, &viewer);
|
||||
settle(cx, |app| viewer.read(app).active_tab().and_then(|tab| tab.risk) == Some(ely_office::Risk::Repaired));
|
||||
let id = cx.update(|_, app| viewer.read(app).core.tabs[0].id);
|
||||
@@ -184,7 +184,7 @@ fn a_picture_never_drawn_is_checked_before_an_overwrite() {
|
||||
let path = dir.path().join("long.pdf");
|
||||
worker.save(doc, &path).expect("saves");
|
||||
let bytes = std::fs::read(&path).expect("reads");
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), &[path.clone()], true);
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), std::slice::from_ref(&path), true);
|
||||
shown(cx, &viewer);
|
||||
for _ in 0..10 {
|
||||
super::frames(cx);
|
||||
|
||||
@@ -212,7 +212,7 @@ fn reopening_the_dialog_checks_the_file_as_it_is_now() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let path = signed(dir.path());
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), &[path.clone()], true);
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), std::slice::from_ref(&path), true);
|
||||
let view = shown(cx, &viewer);
|
||||
let digest = |cx: &mut VisualTestContext| {
|
||||
cx.update(|_, app| viewer.update(app, |viewer, cx| viewer.show_signatures(true, cx)));
|
||||
|
||||
@@ -69,7 +69,7 @@ impl Host for Viewer {
|
||||
}
|
||||
|
||||
fn read_at(&self, tab: u64, cx: &gpui::App) -> Option<ely_pdf_engine::Doc> {
|
||||
self.tab(tab).map(|tab| tab.view.read(cx).doc.clone())
|
||||
self.tab(tab).map(|tab| tab.view.read(cx).doc)
|
||||
}
|
||||
|
||||
fn observed(&mut self, id: u64, view: &Entity<PdfView>, cx: &mut Context<Self>) {
|
||||
|
||||
@@ -45,8 +45,11 @@ pub struct Making {
|
||||
picture: Option<(PathBuf, f32)>,
|
||||
}
|
||||
|
||||
/// Points of each stroke.
|
||||
type Strokes = Vec<Vec<(f32, f32)>>;
|
||||
|
||||
/// Strokes moved to the corner, the longer side 1.
|
||||
pub fn fitted(strokes: &[Vec<(f32, f32)>]) -> Option<(Vec<Vec<(f32, f32)>>, f32)> {
|
||||
pub fn fitted(strokes: &[Vec<(f32, f32)>]) -> Option<(Strokes, f32)> {
|
||||
if strokes.iter().all(|stroke| stroke.len() < 2) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user