From 0835e114cadd01464945ed23e452a9faee55bd08 Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 16 Nov 2026 03:03:33 +0000 Subject: [PATCH] Fix CI lints: samples referenced in every build, missing docs, rustdoc links, deprecated Ui::id, unused manifest dependencies --- crates/aaf/src/omf/bento.rs | 10 +++++ crates/dialogs/src/portal/tests.rs | 3 +- crates/document-bundle/src/lib.rs | 2 +- crates/dxf/src/drawing.rs | 2 +- crates/gridcraft-format/src/lib.rs | 4 +- crates/image-codecs/src/codecs/png.rs | 14 +++---- crates/image-codecs/src/codecs/tiff/decode.rs | 4 +- crates/image-codecs/src/codecs/tiff/tags.rs | 2 +- .../image-codecs/src/codecs/xpm/x11_colors.rs | 2 +- crates/image-codecs/src/orientation.rs | 2 +- crates/pcraft-format/src/tip.rs | 3 ++ crates/proto/src/imap/mod.rs | 38 +++++++++---------- crates/ps/src/lib.rs | 2 +- crates/smime/src/digital_signature.rs | 2 +- crates/smime/src/import.rs | 2 +- crates/svg/Cargo.toml | 4 +- crates/ui-bench/src/bin/foundation/main.rs | 2 +- crates/ui-contract/src/contract/registry.rs | 5 +-- crates/ui-macros/src/component.rs | 2 + crates/update/Cargo.toml | 1 - crates/video/Cargo.toml | 6 +-- crates/webp/src/anim.rs | 2 +- 22 files changed, 63 insertions(+), 51 deletions(-) diff --git a/crates/aaf/src/omf/bento.rs b/crates/aaf/src/omf/bento.rs index 171196fe1..20069826f 100644 --- a/crates/aaf/src/omf/bento.rs +++ b/crates/aaf/src/omf/bento.rs @@ -35,7 +35,9 @@ use std::collections::{BTreeMap, HashMap}; +/// The eight-byte magic number that opens a Bento container. pub const MAGIC: [u8; 8] = [0xA4, b'C', b'M', 0xA5, b'H', b'd', b'r', 0xD7]; +/// The size in bytes of one label in the container table. pub const LABEL_SIZE: usize = 24; // standard object ids @@ -97,6 +99,7 @@ impl Default for Writer { } impl Writer { + /// An empty writer that assigns user object ids from the first free id. pub fn new() -> Writer { Writer { data: Vec::new(), names: HashMap::new(), next: MIN_USER_ID, entries: Vec::new() } } @@ -114,14 +117,17 @@ impl Writer { id } + /// The id of the global property named `name`, assigned on first use. pub fn property(&mut self, name: &str) -> u32 { self.named(GLOBAL_PROP_NAME, name) } + /// The id of the global type named `name`, assigned on first use. pub fn type_id(&mut self, name: &str) -> u32 { self.named(GLOBAL_TYPE_NAME, name) } + /// Allocates the next free user object id. pub fn new_object(&mut self) -> u32 { let id = self.next; self.next += 1; @@ -156,6 +162,7 @@ impl Writer { self.entries.push((obj, OBJ_REFERENCES, TYPE_7BIT_ASCII, vec![seg])); } + /// Finishes the container and returns its bytes. pub fn finish(mut self) -> Vec { let seed = self.next; self.entries.push((TOC_OBJECT, TOC_SEED, TOC_TYPE, vec![Seg::Imm(seed.to_be_bytes().to_vec())])); @@ -245,6 +252,7 @@ impl<'a> Container<'a> { self.objects.keys().copied() } + /// Opens `data` as a Bento container, or says why it is not one. pub fn open(data: &'a [u8]) -> Result, String> { if !sniff(data) { return Err("no Bento label at the end of the file".into()); @@ -362,11 +370,13 @@ impl<'a> Container<'a> { Ok(out) } + /// The id registered for `name`, if any. pub fn id_of(&self, name: &str) -> Option { self.by_name.get(name).copied() } #[allow(dead_code)] + /// The name registered for `id`, if any. pub fn name_of(&self, id: u32) -> Option<&str> { self.names.get(&id).map(String::as_str) } diff --git a/crates/dialogs/src/portal/tests.rs b/crates/dialogs/src/portal/tests.rs index 9aa038a2c..18cbc07e8 100644 --- a/crates/dialogs/src/portal/tests.rs +++ b/crates/dialogs/src/portal/tests.rs @@ -17,7 +17,8 @@ fn the_picked_file_type_gives_a_bare_name_its_extension_and_a_typed_extension_wi let two = [Filter::new("Photoshop", &["psd", "psb"]), Filter::new("PNG", &["png"])]; let only = [Filter::new("Swatches", &["aco"])]; // (path, opened with, filters, picked type, expected path) - let table: [(&str, Option<&str>, &[Filter], Option, &str); 8] = [ + type Case<'a> = (&'a str, Option<&'a str>, &'a [Filter], Option, &'a str); + let table: [Case; 8] = [ ("/s/Untitled", Some("Untitled.psd"), &two, Some(1), "/s/Untitled.png"), ("/s/Untitled.psd", Some("Untitled.psd"), &two, Some(1), "/s/Untitled.png"), ("/s/art.png", Some("art.psd"), &two, Some(0), "/s/art.png"), diff --git a/crates/document-bundle/src/lib.rs b/crates/document-bundle/src/lib.rs index 317ccc1f6..dafb9b95f 100644 --- a/crates/document-bundle/src/lib.rs +++ b/crates/document-bundle/src/lib.rs @@ -179,7 +179,7 @@ pub fn write( Ok(out.into_inner()) } -/// Like [`write`], streaming the archive into `out`. A writer that fails (for example to cancel +/// Like [`fn@write`], streaming the archive into `out`. A writer that fails (for example to cancel /// a long save) stops the write at the next member or buffer and the error is returned. #[allow(clippy::too_many_arguments)] pub fn write_to( diff --git a/crates/dxf/src/drawing.rs b/crates/dxf/src/drawing.rs index 0b52c337c..7130990b0 100644 --- a/crates/dxf/src/drawing.rs +++ b/crates/dxf/src/drawing.rs @@ -19,7 +19,7 @@ pub use crate::model::write::Format; pub struct Handle(pub u32); /// The handles of the fixed objects every drawing has. Entities and table entries count up from -/// [`FIRST_FREE`]. +/// `FIRST_FREE`. pub mod fixed { use super::Handle; pub const LAYER_TABLE: Handle = Handle(0x1); diff --git a/crates/gridcraft-format/src/lib.rs b/crates/gridcraft-format/src/lib.rs index 0a60ace3a..35d2315a7 100644 --- a/crates/gridcraft-format/src/lib.rs +++ b/crates/gridcraft-format/src/lib.rs @@ -40,9 +40,9 @@ pub fn write(workbook: &T) -> Result, Error> { serde_json::to_vec_pretty(workbook).map_err(Error::Write) } -/// [`write`], with `kept` appended to the top-level list `field` (made if absent): entries a +/// [`fn@write`], with `kept` appended to the top-level list `field` (made if absent): entries a /// newer version wrote that this build kept without reading. With nothing kept this is exactly -/// [`write`]. Otherwise the workbook goes through a [`Value`] first, so its object keys are +/// [`fn@write`]. Otherwise the workbook goes through a [`Value`] first, so its object keys are /// written in `serde_json`'s map order. pub fn write_with_kept(workbook: &T, field: &str, kept: &[Value]) -> Result, Error> { if kept.is_empty() { diff --git a/crates/image-codecs/src/codecs/png.rs b/crates/image-codecs/src/codecs/png.rs index a244a1aae..25ead516a 100644 --- a/crates/image-codecs/src/codecs/png.rs +++ b/crates/image-codecs/src/codecs/png.rs @@ -120,7 +120,7 @@ impl> AsRef<[u8]> for SharedInput { /// A PNG decoded in resumable steps, for a caller that must not block for the whole image (the /// web build, which has no threads): [`PngDecodeRows::step`] decodes rows until the caller says to -/// stop, and returns the [`Image`] once the last row and the chunks after it are read. [`decode`] +/// stop, and returns the `Image` once the last row and the chunks after it are read. `decode` /// drives one to the end, so the two give the same image. /// /// An interlaced (Adam7) PNG decodes in a single step: its passes land at stride positions all @@ -158,7 +158,7 @@ pub struct PngDecodeRows> { } impl> PngDecodeRows { - /// Reads the header and refuses what [`decode`] refuses before any pixel is decoded: sizes + /// Reads the header and refuses what `decode` refuses before any pixel is decoded: sizes /// past `limits`, and a file too small for the image it declares. pub fn new(bytes: B, limits: &Limits) -> Result { Self::open(bytes, limits, true, false) @@ -385,11 +385,11 @@ impl> PngDecodeRows { /// Decodes the rows of a [`streamable`](PngDecodeRows::streamable) file a group at a time: /// `sink(y0, data)` gets whole rows `y0..` in final order, `group` of them at a time (the last - /// group may be shorter; 0 counts as 1), native-endian, exactly the samples [`decode`] would + /// group may be shorter; 0 counts as 1), native-endian, exactly the samples `decode` would /// return, and the decoder keeps only that group. Decodes at least one row, then goes on while /// `more()` returns true; `Some` with the extras once the file is read to its end, with the /// resolution a format that lacks one takes from its EXIF or XMP. A damaged file fails with - /// the error [`decode`] gives, after however many rows were delivered. An orientation (an + /// the error `decode` gives, after however many rows were delivered. An orientation (an /// `eXIf` after the image data may set one) is for the caller to apply. A new group size /// must exceed any partial group retained from an earlier yield; otherwise this returns /// an error without consuming another row. @@ -724,7 +724,7 @@ pub(crate) fn has_additional_images(bytes: &[u8]) -> Result { Ok(info.animation_control.is_some_and(|a| u64::from(a.num_frames) + u64::from(info.frame_control.is_none()) > 1)) } -/// The size and pixel format the rows of [`decode_rows`] come in. +/// The size and pixel format the rows of `decode_rows` come in. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct PngHeader { pub width: u32, @@ -733,7 +733,7 @@ pub struct PngHeader { pub sample: SampleType, } -/// Where [`decode_rows`] sends rows: the index of the first, then whole rows. +/// Where `decode_rows` sends rows: the index of the first, then whole rows. pub type PngRowSink<'a, E> = dyn FnMut(u32, &[u8]) -> Result<(), E> + 'a; /// Decodes a PNG a group of rows at a time, so the caller never needs the whole decoded image: @@ -1362,7 +1362,7 @@ fn write_idat(writer: &mut png::Writer, zlib: &[u8], max: usize) -> /// A PNG encoded a band of rows at a time, for images too large to hold whole (a multi-gigapixel /// print): each band is converted to the encode plan, filtered and deflated on all cores as it /// arrives and written as IDAT chunks, so only about one band is ever held. The deflate bands are -/// [`parallel_idat`]'s, so the zlib stream is the one [`crate::encode`] writes for a large image. +/// `parallel_idat`'s, so the zlib stream is the one `crate::encode` writes for a large image. /// Never interlaced (Adam7 needs the whole image). pub struct PngRows { writer: png::Writer, diff --git a/crates/image-codecs/src/codecs/tiff/decode.rs b/crates/image-codecs/src/codecs/tiff/decode.rs index a9caa98ee..c365d0158 100644 --- a/crates/image-codecs/src/codecs/tiff/decode.rs +++ b/crates/image-codecs/src/codecs/tiff/decode.rs @@ -85,7 +85,7 @@ const GROUP_BYTES: usize = 64 << 20; /// A TIFF page opened for decoding a group of bands at a time, for images too large to hold /// twice (#8169): [`TiffBands::decode`] hands each group to its caller, who writes it into the /// document, so only one group exists beside the document. The pixels, layout and metadata are -/// those [`decode_page`] returns; [`TiffBands::upright`] applies the orientation as +/// those `decode_page` returns; `TiffBands::upright` applies the orientation as /// [`Image::oriented`] does. pub struct TiffBands<'a> { b: &'a [u8], @@ -103,7 +103,7 @@ pub struct TiffBands<'a> { } impl<'a> TiffBands<'a> { - /// Opens page `page` (`None`: the page [`decode_page`] opens by default) and checks it + /// Opens page `page` (`None`: the page `decode_page` opens by default) and checks it /// against `limits`; on 64-bit targets its `max_alloc` bounds each group of bands, not the /// whole image. pub fn open(bytes: &'a [u8], page: Option, limits: &Limits) -> Result { diff --git a/crates/image-codecs/src/codecs/tiff/tags.rs b/crates/image-codecs/src/codecs/tiff/tags.rs index a41b15413..fc6384a7b 100644 --- a/crates/image-codecs/src/codecs/tiff/tags.rs +++ b/crates/image-codecs/src/codecs/tiff/tags.rs @@ -10,7 +10,7 @@ pub(super) const TAG_PHOTOSHOP: u16 = 34377; /// Photoshop `ImageSourceData`: the layers of a layered TIFF. pub(super) const TAG_IMAGE_SOURCE_DATA: u16 = 37724; -/// `true` when [`encode`] writes little-endian (`II`) files: the `tiff` encoder writes the +/// `true` when `encode` writes little-endian (`II`) files: the `tiff` encoder writes the /// running target's byte order, and every target PhotoCraft builds for is little-endian. /// Byte-order-sensitive payloads (Photoshop layer data) must be produced to match. pub fn writes_little_endian() -> bool { diff --git a/crates/image-codecs/src/codecs/xpm/x11_colors.rs b/crates/image-codecs/src/codecs/xpm/x11_colors.rs index 1d47b3706..31986999a 100644 --- a/crates/image-codecs/src/codecs/xpm/x11_colors.rs +++ b/crates/image-codecs/src/codecs/xpm/x11_colors.rs @@ -1,6 +1,6 @@ //! X11 color-name database (X.Org rgb.txt) normalized to lowercase without //! spaces, underscores, or hyphens. RGB values are *X11* values, not CSS values. -//! Source: https://cgit.freedesktop.org/xorg/app/rgb/tree/rgb.txt +//! Source: //! License: MIT (X.Org Foundation), see the upstream app/rgb COPYING file. //! Aliases differing only in case or spaces have been collapsed. //! Keep sorted: decoder uses binary search without allocation per candidate. diff --git a/crates/image-codecs/src/orientation.rs b/crates/image-codecs/src/orientation.rs index fd5ec9c97..d0db64bc1 100644 --- a/crates/image-codecs/src/orientation.rs +++ b/crates/image-codecs/src/orientation.rs @@ -179,7 +179,7 @@ impl OrientSteps { if self.oh == 0 { 1.0 } else { self.done as f32 / self.oh as f32 } } - /// Writes bands of [`BAND`] output rows, at least one, then goes on while `more()` returns + /// Writes bands of `BAND` output rows, at least one, then goes on while `more()` returns /// true; `Some` with the upright image once the last band is written. pub fn step(&mut self, more: &mut dyn FnMut() -> bool) -> Result, CodecError> { if !(2..=8).contains(&self.o) { diff --git a/crates/pcraft-format/src/tip.rs b/crates/pcraft-format/src/tip.rs index 9b971f5d9..bd3af13e9 100644 --- a/crates/pcraft-format/src/tip.rs +++ b/crates/pcraft-format/src/tip.rs @@ -14,8 +14,11 @@ const TIP_HEADER: usize = 6 + 1 + 4 + 4; /// Decoded grayscale samples. Eight-bit samples expand losslessly by multiplication by 257. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Tip { + /// Width in pixels. pub width: u32, + /// Height in pixels. pub height: u32, + /// Row-major grayscale samples, `width * height` of them. pub data: Vec, } diff --git a/crates/proto/src/imap/mod.rs b/crates/proto/src/imap/mod.rs index d469bffcc..42a5713e2 100644 --- a/crates/proto/src/imap/mod.rs +++ b/crates/proto/src/imap/mod.rs @@ -612,7 +612,7 @@ fn is_date_time(text: &str) -> bool { } /// Whether [`Imap::uid_search_header`] can look for `text`: printable ASCII, at most -/// [`MAX_QUOTED`] bytes. What it can't be asked for, it refuses unsent. +/// `MAX_QUOTED` bytes. What it can't be asked for, it refuses unsent. pub fn searchable(text: &str) -> bool { !text.is_empty() && text.len() <= MAX_QUOTED && text.bytes().all(|b| matches!(b, b' '..=b'~')) } @@ -812,7 +812,7 @@ impl Imap { } /// [`list`](Self::list), and how many more mailboxes the server listed that were read and - /// dropped because the list was full ([`MAX_MAILBOXES`], [`MAX_LIST_BYTES`]): 0 when it + /// dropped because the list was full (`MAX_MAILBOXES`, `MAX_LIST_BYTES`): 0 when it /// was kept whole. pub fn list_counted(&mut self) -> Result<(Vec, usize), ProtoError> { let mut out: Vec = Vec::new(); @@ -857,7 +857,7 @@ impl Imap { Ok(self.selected.clone()) } - /// UID FETCH (UID FLAGS): every message in the set with its flags. `set` like "1:*" or "5,9,12:20". + /// UID FETCH `` (UID FLAGS): every message in the set with its flags. `set` like "1:*" or "5,9,12:20". /// /// The messages come back in UID order, each once. pub fn uid_fetch_flags(&mut self, set: &str) -> Result, ProtoError> { @@ -868,7 +868,7 @@ impl Imap { /// well (`UID FETCH (UID FLAGS X-GM-MSGID X-GM-LABELS)`, in [`Fetched::gmail_id`] and /// [`Fetched::gmail_labels`]): for Gmail's server alone, which documents them among its IMAP /// extensions. A message it gives no id, or one that isn't a number, has none; one it gives - /// no labels has `None` there, and one past [`MAX_GMAIL_LABEL_BYTES`] of labels in the fetch + /// no labels has `None` there, and one past `MAX_GMAIL_LABEL_BYTES` of labels in the fetch /// too. pub fn uid_fetch_flags_gmail(&mut self, set: &str) -> Result, ProtoError> { self.fetch_flags(set, true, true) @@ -944,7 +944,7 @@ impl Imap { .collect()) } - /// UID FETCH (UID RFC822.SIZE): the size in bytes of every message in the set, in UID order. + /// UID FETCH `` (UID RFC822.SIZE): the size in bytes of every message in the set, in UID order. pub fn uid_fetch_sizes(&mut self, set: &str) -> Result, ProtoError> { let mut out: Vec<(u32, u64)> = Vec::new(); let command = Self::fetch(set, "(UID RFC822.SIZE)")?; @@ -966,12 +966,12 @@ impl Imap { Ok(out) } - /// UID FETCH (UID FLAGS INTERNALDATE BODY.PEEK[]); `None` when the UID is gone. + /// UID FETCH `` (UID FLAGS INTERNALDATE BODY.PEEK[]); `None` when the UID is gone. pub fn uid_fetch_message(&mut self, uid: u32) -> Result, ProtoError> { self.fetch_one(uid, "(UID FLAGS INTERNALDATE BODY.PEEK[])", false) } - /// UID FETCH (UID FLAGS INTERNALDATE BODY.PEEK[HEADER]): the header alone of a message + /// UID FETCH `` (UID FLAGS INTERNALDATE `BODY.PEEK[HEADER]`): the header alone of a message /// that is not taken whole (one that is too large), in [`Fetched::body`], up to and with the /// empty line that ends it. `None` when the UID is gone. pub fn uid_fetch_header(&mut self, uid: u32) -> Result, ProtoError> { @@ -1003,7 +1003,7 @@ impl Imap { Ok(found.filter(|message| message.body.is_some())) } - /// UID STORE +FLAGS.SILENT / -FLAGS.SILENT (flags). + /// UID STORE `` +FLAGS.SILENT / -FLAGS.SILENT (flags). pub fn uid_store(&mut self, uid: u32, add: bool, flags: &[&str]) -> Result<(), ProtoError> { let flags = flag_list(flags)?; if uid == 0 { @@ -1012,7 +1012,7 @@ impl Imap { self.store(&uid.to_string(), add, &flags) } - /// UID STORE +FLAGS.SILENT / -FLAGS.SILENT (flags): the same change for every message + /// UID STORE `` +FLAGS.SILENT / -FLAGS.SILENT (flags): the same change for every message /// the set names (number by number, as [`uid_sets`] writes it; `1:*` is refused). A UID that /// is no longer there is passed over by the server without a word. pub fn uid_store_set(&mut self, set: &str, add: bool, flags: &[&str]) -> Result<(), ProtoError> { @@ -1020,9 +1020,9 @@ impl Imap { self.store(named(set)?, add, &flags) } - /// UID SEARCH UNDELETED HEADER : the messages of the open mailbox, other than + /// UID SEARCH UNDELETED HEADER `` ``: the messages of the open mailbox, other than /// those marked as deleted, whose header field `field` has `text` in it (the server matches a - /// part of the field, whatever its case), by UID in UID order, at most [`MAX_FOUND`] of them. + /// part of the field, whatever its case), by UID in UID order, at most `MAX_FOUND` of them. /// `field` is a field's name, and `text` one that [`searchable`] lets through: anything else /// is refused unsent. pub fn uid_search_header(&mut self, field: &str, text: &str) -> Result, ProtoError> { @@ -1048,15 +1048,15 @@ impl Imap { Ok(found.into_iter().collect()) } - /// UID SEARCH UID UNDELETED X-GM-RAW "": the messages of the open mailbox, among + /// UID SEARCH UID `` UNDELETED X-GM-RAW "``": the messages of the open mailbox, among /// those `set` names and not marked as deleted, that Gmail's own search finds for `query` /// (`category:social`), by UID in UID order. `X-GM-RAW` is Gmail's (Google's "Gmail IMAP extensions"): for Gmail's server alone. /// /// The query goes in quotes, without the CR, LF and NUL that could end the command early; one - /// that is empty then, or isn't printable ASCII within [`MAX_QUOTED`] bytes, is refused unsent. + /// that is empty then, or isn't printable ASCII within `MAX_QUOTED` bytes, is refused unsent. /// Of the answer, only UIDs inside `set` are taken, at most [`MAX_GMAIL_FOUND`] of them: a /// caller that wants them all asks for sets of fewer messages than that. An answer longer than - /// [`MAX_LINE`](crate::MAX_LINE) is read past and refused ([`ProtoError::Rejected`]): the + /// [`MAX_LINE`] is read past and refused ([`ProtoError::Rejected`]): the /// session goes on. pub fn uid_search_gmail(&mut self, set: &str, query: &str) -> Result, ProtoError> { if !is_set(set) { @@ -1101,14 +1101,14 @@ impl Imap { self.run(command, &mut ignore).map(|_| ()) } - /// UID MOVE (RFC 6851, for a server that offers `MOVE`): the messages leave + /// UID MOVE `` `` (RFC 6851, for a server that offers `MOVE`): the messages leave /// the open mailbox for the named one in one step. Answers where they are now when the /// server says so beyond doubt (`COPYUID`), `None` otherwise. pub fn uid_move(&mut self, set: &str, raw_name: &str) -> Result, ProtoError> { self.transfer("UID MOVE", set, raw_name) } - /// UID COPY : copies of the messages are added to the named mailbox. Answers + /// UID COPY `` ``: copies of the messages are added to the named mailbox. Answers /// like [`uid_move`](Self::uid_move). pub fn uid_copy(&mut self, set: &str, raw_name: &str) -> Result, ProtoError> { self.transfer("UID COPY", set, raw_name) @@ -1126,7 +1126,7 @@ impl Imap { done.map(|_| copied) } - /// UID EXPUNGE (RFC 4315): the messages of the set that are marked `\Deleted` go for + /// UID EXPUNGE `` (RFC 4315): the messages of the set that are marked `\Deleted` go for /// good, and no others. Refused unsent unless the server has said `UIDPLUS`: a server /// without it only knows the EXPUNGE that takes every marked message of the mailbox. pub fn uid_expunge(&mut self, set: &str) -> Result<(), ProtoError> { @@ -1137,13 +1137,13 @@ impl Imap { self.run(Command::new("UID EXPUNGE").arg(set), &mut ignore).map(|_| ()) } - /// CREATE . `raw_name` is the name as the server wants it: in modified UTF-7 + /// CREATE ``. `raw_name` is the name as the server wants it: in modified UTF-7 /// ([`encode_utf7`]), its levels joined with the server's own delimiter. pub fn create(&mut self, raw_name: &str) -> Result<(), ProtoError> { self.run(Command::new("CREATE").string(raw_name.as_bytes()), &mut ignore).map(|_| ()) } - /// SUBSCRIBE : other mail programs list subscribed mailboxes only. + /// SUBSCRIBE ``: other mail programs list subscribed mailboxes only. pub fn subscribe(&mut self, raw_name: &str) -> Result<(), ProtoError> { self.run(Command::new("SUBSCRIBE").string(raw_name.as_bytes()), &mut ignore).map(|_| ()) } diff --git a/crates/ps/src/lib.rs b/crates/ps/src/lib.rs index ab5383259..4480dae16 100644 --- a/crates/ps/src/lib.rs +++ b/crates/ps/src/lib.rs @@ -1,6 +1,6 @@ //! PostScript and EPS for the Craft apps. //! -//! - [`read`] (feature `read`): runs an EPS and gives what it paints as a one-page vector PDF, +//! - `read` (feature `read`): runs an EPS and gives what it paints as a one-page vector PDF, //! for apps that place EPS files as graphics. #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] #![forbid(unsafe_code)] diff --git a/crates/smime/src/digital_signature.rs b/crates/smime/src/digital_signature.rs index 19bb572f7..a586f0650 100644 --- a/crates/smime/src/digital_signature.rs +++ b/crates/smime/src/digital_signature.rs @@ -269,7 +269,7 @@ impl DigitalSignature { } /// `text` (a name or address from a certificate) as a name coming in is kept -/// ([`crate::names::incoming`]): one line, without control or format characters (no +/// (`crate::names::incoming`): one line, without control or format characters (no /// reordering by a bidirectional override, nothing hidden by a zero-width one), at most /// [`MAX_SIGNER_TEXT`] characters. pub fn signer_text(text: &str) -> String { diff --git a/crates/smime/src/import.rs b/crates/smime/src/import.rs index 216cfaa92..2a387e281 100644 --- a/crates/smime/src/import.rs +++ b/crates/smime/src/import.rs @@ -28,7 +28,7 @@ pub struct CertificateInfo { pub addresses: Vec, /// Until when it is valid. pub not_after: Timestamp, - /// Whether it is for mail ([`Cert::for_mail`]). + /// Whether it is for mail (`Cert::for_mail`). pub for_mail: bool, /// Whether it is a certification authority's. pub authority: bool, diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index 3b778da47..7516ddab2 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -13,7 +13,7 @@ workspace = true [dependencies] craft-xml = { workspace = true } quick-xml = { version = "0.41", default-features = false } -craft-image-codecs = { workspace = true } +craft-image-codecs = { workspace = true, optional = true } # SVGZ (gzip), pure-Rust backend. flate2 = { version = "1", default-features = false, features = ["rust_backend"] } kurbo = { workspace = true } @@ -32,7 +32,7 @@ data-url = { version = "0.3.2", optional = true } [features] # `craft_svg::tree`: usvg behind the bounded entry point. -tree = ["dep:usvg", "dep:data-url"] +tree = ["dep:usvg", "dep:data-url", "dep:craft-image-codecs"] # Text converted to paths (needs a font database in the options). tree-text = ["tree", "usvg/text"] # The system's fonts in `usvg::fontdb`. diff --git a/crates/ui-bench/src/bin/foundation/main.rs b/crates/ui-bench/src/bin/foundation/main.rs index 6b7dadd43..39357ca57 100644 --- a/crates/ui-bench/src/bin/foundation/main.rs +++ b/crates/ui-bench/src/bin/foundation/main.rs @@ -473,7 +473,7 @@ impl Scene for CanvasViewScene { // The scene's motion: a pan every frame, as a user's drag would make. pan(view, vec2(3.0, 2.0)); let text = RulerText::new(RulerUnits::pixels(), UnitKind::Pixels); - let canvas = ui.id().with("canvas scene"); + let canvas = ui.scope_id().with("canvas scene"); let shown = Canvas::new("Document").id(canvas).view(*view).rulers(text, text, *zero).show_rulers(true).show(ui, |ui, body| { let _ = RasterDisplay::new("Picture", &SOURCE).show_at(ui, body.rect); let _ = Guides::new("Guides", canvas, Bind::bound(&mut *guides)).show_at(ui, body.rect); diff --git a/crates/ui-contract/src/contract/registry.rs b/crates/ui-contract/src/contract/registry.rs index a124b933c..d200a2e6c 100644 --- a/crates/ui-contract/src/contract/registry.rs +++ b/crates/ui-contract/src/contract/registry.rs @@ -461,8 +461,5 @@ macro_rules! __register_pattern { #[macro_export] #[cfg(not(feature = "testing"))] macro_rules! __register_contract { - ($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [$($sample:path)?], $purpose:expr) => { - // Keeps the sample referenced, so it is never dead code when `testing` is off. - $(const _: () = { let _ = $sample; };)? - }; + ($ty:ty, $shape:ident, $overlay:expr, [$(($case:expr, $reason:expr)),*], [$($sample:path)?], $purpose:expr) => {}; } diff --git a/crates/ui-macros/src/component.rs b/crates/ui-macros/src/component.rs index 0e632c490..eb317656d 100644 --- a/crates/ui-macros/src/component.rs +++ b/crates/ui-macros/src/component.rs @@ -219,6 +219,8 @@ fn registrations(k: &TokenStream, types: &[Type], declared: &Declared, shape: Sh let each = types.iter().map(|ty| quote!(#k::__register_contract!(#ty, #shape, #overlay, [#(#exempt),*], [#(#sample)*], #purpose);)); let gate = registration_gate(); Ok(quote! { + // Outside the gate: the sample exists in every build, so it is never dead code where the registration is absent. + #(const _: () = { let _ = #sample; };)* #gate const _: () = { #(#each)* diff --git a/crates/update/Cargo.toml b/crates/update/Cargo.toml index a9bdbc5e7..0d6f2debc 100644 --- a/crates/update/Cargo.toml +++ b/crates/update/Cargo.toml @@ -34,7 +34,6 @@ image = { version = "0.25", default-features = false, features = ["png"], option serde = { workspace = true } serde_json = { workspace = true } log = "0.4" -getrandom = "0.3" tempfile = "3" sha2 = "0.10" ureq = { version = "3.4", default-features = false, features = ["rustls-no-provider", "_ring", "gzip", "platform-verifier"] } diff --git a/crates/video/Cargo.toml b/crates/video/Cargo.toml index dae21e5b1..8dadf4c12 100644 --- a/crates/video/Cargo.toml +++ b/crates/video/Cargo.toml @@ -16,7 +16,7 @@ workspace = true [features] # Every codec feature turns on one codec module; none is on by default. # DNxHD / DNxHR (SMPTE ST 2019-1): decoder and encoder. -dnx = [] +dnx = ["dep:craft-media"] # APV (Advanced Professional Video, RFC 9924): decoder and encoder; `apv-decode` or `apv-encode` for one of them. apv = ["apv-decode", "apv-encode"] apv-decode = ["craft-media/bitstream"] @@ -52,7 +52,7 @@ vp9-decode = ["craft-media/bitstream"] vp9-encode = ["craft-media/isobmff"] # AV1: decoder and encoder; `av1-decode` or `av1-encode` for one of them. av1 = ["av1-decode", "av1-encode"] -av1-decode = [] +av1-decode = ["dep:craft-media"] av1-encode = ["craft-media/isobmff"] # Tiled AV1 fallback for frames that exceed the clean-room encoder's single-tile limits. av1-large-encode = ["av1-encode", "dep:rav1e"] @@ -60,7 +60,7 @@ av1-large-encode = ["av1-encode", "dep:rav1e"] threads = ["dep:rayon"] [dependencies] -craft-media = { workspace = true } +craft-media = { workspace = true, optional = true } thiserror = { workspace = true } rayon = { workspace = true, optional = true } diff --git a/crates/webp/src/anim.rs b/crates/webp/src/anim.rs index 7d63c75b7..3de243c9c 100644 --- a/crates/webp/src/anim.rs +++ b/crates/webp/src/anim.rs @@ -1,6 +1,6 @@ //! Animated WebP writing: the `VP8X`, `ANIM` and `ANMF` chunks around frames another encoder //! made ([`animation`]), and, with feature `vp8`, whole lossy animations from RGBA frames through -//! `craft-video`'s VP8 encoder ([`lossy_animation`]). +//! `craft-video`'s VP8 encoder (`lossy_animation`). use crate::{Error, MAX_CANVAS, MAX_VP8_DIMENSION, chunk};