Reduce development environment warnings and remove DWARF debug symbols (#2741)

* Ignore tauri gen

* Deny warnings on CI

* Fix all warnings in current nightly rustc

* Disable DWARF debug info for development builds

* Fix typo

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay 2025-06-22 11:10:25 +01:00 committed by GitHub
parent 8e5abf65cb
commit 4344f28909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 53 additions and 7968 deletions

View file

@ -84,6 +84,8 @@ jobs:
mold -run cargo fmt --all -- --check
- name: 🦀 Build Rust code
env:
RUSTFLAGS: -Dwarnings
run: |
mold -run cargo build --all-features

View file

@ -16,7 +16,8 @@ use graphene_std::transform::Footprint;
use graphene_std::vector::style::ViewMode;
#[impl_message(Message, PortfolioMessage, Document)]
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
#[derive(derivative::Derivative, Clone, serde::Serialize, serde::Deserialize)]
#[derivative(Debug, PartialEq)]
pub enum DocumentMessage {
Noop,
// Sub-messages
@ -157,6 +158,7 @@ pub enum DocumentMessage {
},
SetSnapping {
#[serde(skip)]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
closure: Option<for<'a> fn(&'a mut SnappingState) -> &'a mut bool>,
snapping_state: bool,
},

View file

@ -2,10 +2,19 @@ use super::utility_types::{OverlayProvider, empty_provider};
use crate::messages::prelude::*;
#[impl_message(Message, DocumentMessage, Overlays)]
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
#[derive(derivative::Derivative, Clone, serde::Serialize, serde::Deserialize)]
#[derivative(Debug, PartialEq)]
pub enum OverlaysMessage {
Draw,
// Serde functionality isn't used but is required by the message system macros
AddProvider(#[serde(skip, default = "empty_provider")] OverlayProvider),
RemoveProvider(#[serde(skip, default = "empty_provider")] OverlayProvider),
AddProvider(
#[serde(skip, default = "empty_provider")]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
OverlayProvider,
),
RemoveProvider(
#[serde(skip, default = "empty_provider")]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
OverlayProvider,
),
}

View file

@ -294,7 +294,7 @@ impl LayerNodeIdentifier {
}
/// Iterator over all direct children (excluding self and recursive children)
pub fn children(self, metadata: &DocumentMetadata) -> AxisIter {
pub fn children(self, metadata: &DocumentMetadata) -> AxisIter<'_> {
AxisIter {
layer_node: self.first_child(metadata),
next_node: Self::next_sibling,
@ -302,7 +302,7 @@ impl LayerNodeIdentifier {
}
}
pub fn downstream_siblings(self, metadata: &DocumentMetadata) -> AxisIter {
pub fn downstream_siblings(self, metadata: &DocumentMetadata) -> AxisIter<'_> {
AxisIter {
layer_node: Some(self),
next_node: Self::previous_sibling,
@ -311,7 +311,7 @@ impl LayerNodeIdentifier {
}
/// All ancestors of this layer, including self, going to the document root
pub fn ancestors(self, metadata: &DocumentMetadata) -> AxisIter {
pub fn ancestors(self, metadata: &DocumentMetadata) -> AxisIter<'_> {
AxisIter {
layer_node: Some(self),
next_node: Self::parent,
@ -320,7 +320,7 @@ impl LayerNodeIdentifier {
}
/// Iterator through all the last children, starting from self
pub fn last_children(self, metadata: &DocumentMetadata) -> AxisIter {
pub fn last_children(self, metadata: &DocumentMetadata) -> AxisIter<'_> {
AxisIter {
layer_node: Some(self),
next_node: Self::last_child,
@ -329,7 +329,7 @@ impl LayerNodeIdentifier {
}
/// Iterator through all descendants, including recursive children (not including self)
pub fn descendants(self, metadata: &DocumentMetadata) -> DescendantsIter {
pub fn descendants(self, metadata: &DocumentMetadata) -> DescendantsIter<'_> {
DescendantsIter {
front: self.first_child(metadata),
back: self.last_child(metadata).and_then(|child| child.last_children(metadata).last()),

View file

@ -578,7 +578,9 @@ impl BoundingBoxManager {
category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::Narrow | TransformCageSizeCategory::ReducedLandscape
) {
horizontal_edges.map(|point| draw_handle(point, horizontal_angle));
for point in horizontal_edges {
draw_handle(point, horizontal_angle);
}
}
// Draw the vertical midpoint drag handles
@ -586,7 +588,9 @@ impl BoundingBoxManager {
category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::Narrow | TransformCageSizeCategory::ReducedPortrait
) {
vertical_edges.map(|point| draw_handle(point, vertical_angle));
for point in vertical_edges {
draw_handle(point, vertical_angle);
}
}
let angle = quad
@ -601,7 +605,9 @@ impl BoundingBoxManager {
category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::ReducedBoth | TransformCageSizeCategory::ReducedLandscape | TransformCageSizeCategory::ReducedPortrait
) {
quad.0.map(|point| draw_handle(point, angle));
for point in quad.0 {
draw_handle(point, angle);
}
}
// Draw the flat line endpoint drag handles

View file

@ -1,3 +1,5 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Generated by tauri
gen/

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["http:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","http:default","core:app:allow-app-show","core:app:allow-app-hide","shell:default","http:default"]}}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -46,7 +46,7 @@ wasm-opt = false
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
debug-js-glue = true
demangle-name-section = true
dwarf-debug-info = true
dwarf-debug-info = false
[package.metadata.wasm-pack.profile.release]
wasm-opt = ["-Os", "-g"]

View file

@ -104,7 +104,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
}
/// Returns an iterator of the [Bezier]s along the `Subpath`.
pub fn iter(&self) -> SubpathIter<PointId> {
pub fn iter(&self) -> SubpathIter<'_, PointId> {
SubpathIter {
subpath: self,
index: 0,
@ -113,7 +113,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
}
/// Returns an iterator of the [Bezier]s along the `Subpath` always considering it as a closed subpath.
pub fn iter_closed(&self) -> SubpathIter<PointId> {
pub fn iter_closed(&self) -> SubpathIter<'_, PointId> {
SubpathIter {
subpath: self,
index: 0,

View file

@ -54,7 +54,7 @@ impl<T> Instances<T> {
})
}
pub fn instance_ref_iter(&self) -> impl DoubleEndedIterator<Item = InstanceRef<T>> + Clone {
pub fn instance_ref_iter(&self) -> impl DoubleEndedIterator<Item = InstanceRef<'_, T>> + Clone {
self.instance
.iter()
.zip(self.transform.iter())
@ -68,7 +68,7 @@ impl<T> Instances<T> {
})
}
pub fn instance_mut_iter(&mut self) -> impl DoubleEndedIterator<Item = InstanceMut<T>> {
pub fn instance_mut_iter(&mut self) -> impl DoubleEndedIterator<Item = InstanceMut<'_, T>> {
self.instance
.iter_mut()
.zip(self.transform.iter_mut())
@ -82,7 +82,7 @@ impl<T> Instances<T> {
})
}
pub fn get(&self, index: usize) -> Option<InstanceRef<T>> {
pub fn get(&self, index: usize) -> Option<InstanceRef<'_, T>> {
if index >= self.instance.len() {
return None;
}
@ -95,7 +95,7 @@ impl<T> Instances<T> {
})
}
pub fn get_mut(&mut self, index: usize) -> Option<InstanceMut<T>> {
pub fn get_mut(&mut self, index: usize) -> Option<InstanceMut<'_, T>> {
if index >= self.instance.len() {
return None;
}
@ -207,7 +207,7 @@ impl<T> Instance<T> {
}
}
pub fn to_instance_ref(&self) -> InstanceRef<T> {
pub fn to_instance_ref(&self) -> InstanceRef<'_, T> {
InstanceRef {
instance: &self.instance,
transform: &self.transform,
@ -216,7 +216,7 @@ impl<T> Instance<T> {
}
}
pub fn to_instance_mut(&mut self) -> InstanceMut<T> {
pub fn to_instance_mut(&mut self) -> InstanceMut<'_, T> {
InstanceMut {
instance: &mut self.instance,
transform: &mut self.transform,

View file

@ -182,7 +182,7 @@ impl<T: Hash> MemoHash<T> {
hasher.finish()
}
pub fn inner_mut(&mut self) -> MemoHashGuard<T> {
pub fn inner_mut(&mut self) -> MemoHashGuard<'_, T> {
MemoHashGuard { inner: self }
}
pub fn into_inner(self) -> T {

View file

@ -208,7 +208,7 @@ pub fn bounding_box(str: &str, buzz_face: Option<&rustybuzz::Face>, typesetting:
bounds
}
pub fn load_face(data: &[u8]) -> rustybuzz::Face {
pub fn load_face(data: &[u8]) -> rustybuzz::Face<'_> {
rustybuzz::Face::from_slice(data, 0).expect("Loading font failed")
}

View file

@ -846,7 +846,7 @@ impl VectorData {
})
}
pub fn build_stroke_path_iter(&self) -> StrokePathIter {
pub fn build_stroke_path_iter(&self) -> StrokePathIter<'_> {
let mut points = vec![StrokePathIterPointMetadata::default(); self.point_domain.ids().len()];
for (segment_index, (&start, &end)) in self.segment_domain.start_point.iter().zip(&self.segment_domain.end_point).enumerate() {
points[start].set(StrokePathIterPointSegmentMetadata::new(segment_index, false));

View file

@ -25,11 +25,11 @@ use std::hash::{Hash, Hasher};
/// Implemented for types that can be converted to an iterator of vector data.
/// Used for the fill and stroke node so they can be used on VectorData or GraphicGroup
trait VectorDataTableIterMut {
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<VectorData>>;
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<'_, VectorData>>;
}
impl VectorDataTableIterMut for GraphicGroupTable {
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<VectorData>> {
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<'_, VectorData>> {
// Grab only the direct children
self.instance_mut_iter()
.filter_map(|element| element.instance.as_vector_data_mut())
@ -38,7 +38,7 @@ impl VectorDataTableIterMut for GraphicGroupTable {
}
impl VectorDataTableIterMut for VectorDataTable {
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<VectorData>> {
fn vector_iter_mut(&mut self) -> impl Iterator<Item = InstanceMut<'_, VectorData>> {
self.instance_mut_iter()
}
}

View file

@ -389,7 +389,7 @@ impl NodeInput {
pub fn as_value(&self) -> Option<&TaggedValue> {
if let NodeInput::Value { tagged_value, .. } = self { Some(tagged_value) } else { None }
}
pub fn as_value_mut(&mut self) -> Option<MemoHashGuard<TaggedValue>> {
pub fn as_value_mut(&mut self) -> Option<MemoHashGuard<'_, TaggedValue>> {
if let NodeInput::Value { tagged_value, .. } = self { Some(tagged_value.inner_mut()) } else { None }
}
pub fn as_non_exposed_value(&self) -> Option<&TaggedValue> {
@ -1245,7 +1245,7 @@ impl NodeNetwork {
}
/// Create a [`RecursiveNodeIter`] that iterates over all [`DocumentNode`]s, including ones that are deeply nested.
pub fn recursive_nodes(&self) -> RecursiveNodeIter {
pub fn recursive_nodes(&self) -> RecursiveNodeIter<'_> {
let nodes = self.nodes.iter().collect();
RecursiveNodeIter { nodes }
}

View file

@ -32,5 +32,5 @@ impl Compiler {
}
pub trait Executor<I, O> {
fn execute(&self, input: I) -> LocalFuture<Result<O, Box<dyn Error>>>;
fn execute(&self, input: I) -> LocalFuture<'_, Result<O, Box<dyn Error>>>;
}

View file

@ -120,7 +120,7 @@ impl<I> Executor<I, TaggedValue> for &DynamicExecutor
where
I: StaticType + 'static + Send + Sync + std::panic::UnwindSafe,
{
fn execute(&self, input: I) -> LocalFuture<Result<TaggedValue, Box<dyn Error>>> {
fn execute(&self, input: I) -> LocalFuture<'_, Result<TaggedValue, Box<dyn Error>>> {
Box::pin(async move {
use futures::FutureExt;

View file

@ -34,7 +34,7 @@ wasm-opt = false
[package.metadata.wasm-pack.profile.dev.wasm-bindgen]
debug-js-glue = true
demangle-name-section = true
dwarf-debug-info = true
dwarf-debug-info = false
[package.metadata.wasm-pack.profile.release]
wasm-opt = ["-Oz", "--enable-bulk-memory"]