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 03:10:25 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent 8e5abf65cb
commit 4344f28909
22 changed files with 53 additions and 7968 deletions
+2
View File
@@ -84,6 +84,8 @@ jobs:
mold -run cargo fmt --all -- --check mold -run cargo fmt --all -- --check
- name: 🦀 Build Rust code - name: 🦀 Build Rust code
env:
RUSTFLAGS: -Dwarnings
run: | run: |
mold -run cargo build --all-features mold -run cargo build --all-features
@@ -16,7 +16,8 @@ use graphene_std::transform::Footprint;
use graphene_std::vector::style::ViewMode; use graphene_std::vector::style::ViewMode;
#[impl_message(Message, PortfolioMessage, Document)] #[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 { pub enum DocumentMessage {
Noop, Noop,
// Sub-messages // Sub-messages
@@ -157,6 +158,7 @@ pub enum DocumentMessage {
}, },
SetSnapping { SetSnapping {
#[serde(skip)] #[serde(skip)]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
closure: Option<for<'a> fn(&'a mut SnappingState) -> &'a mut bool>, closure: Option<for<'a> fn(&'a mut SnappingState) -> &'a mut bool>,
snapping_state: bool, snapping_state: bool,
}, },
@@ -2,10 +2,19 @@ use super::utility_types::{OverlayProvider, empty_provider};
use crate::messages::prelude::*; use crate::messages::prelude::*;
#[impl_message(Message, DocumentMessage, Overlays)] #[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 { pub enum OverlaysMessage {
Draw, Draw,
// Serde functionality isn't used but is required by the message system macros // Serde functionality isn't used but is required by the message system macros
AddProvider(#[serde(skip, default = "empty_provider")] OverlayProvider), AddProvider(
RemoveProvider(#[serde(skip, default = "empty_provider")] OverlayProvider), #[serde(skip, default = "empty_provider")]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
OverlayProvider,
),
RemoveProvider(
#[serde(skip, default = "empty_provider")]
#[derivative(Debug = "ignore", PartialEq = "ignore")]
OverlayProvider,
),
} }
@@ -294,7 +294,7 @@ impl LayerNodeIdentifier {
} }
/// Iterator over all direct children (excluding self and recursive children) /// 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 { AxisIter {
layer_node: self.first_child(metadata), layer_node: self.first_child(metadata),
next_node: Self::next_sibling, 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 { AxisIter {
layer_node: Some(self), layer_node: Some(self),
next_node: Self::previous_sibling, next_node: Self::previous_sibling,
@@ -311,7 +311,7 @@ impl LayerNodeIdentifier {
} }
/// All ancestors of this layer, including self, going to the document root /// 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 { AxisIter {
layer_node: Some(self), layer_node: Some(self),
next_node: Self::parent, next_node: Self::parent,
@@ -320,7 +320,7 @@ impl LayerNodeIdentifier {
} }
/// Iterator through all the last children, starting from self /// 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 { AxisIter {
layer_node: Some(self), layer_node: Some(self),
next_node: Self::last_child, next_node: Self::last_child,
@@ -329,7 +329,7 @@ impl LayerNodeIdentifier {
} }
/// Iterator through all descendants, including recursive children (not including self) /// 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 { DescendantsIter {
front: self.first_child(metadata), front: self.first_child(metadata),
back: self.last_child(metadata).and_then(|child| child.last_children(metadata).last()), back: self.last_child(metadata).and_then(|child| child.last_children(metadata).last()),
@@ -578,7 +578,9 @@ impl BoundingBoxManager {
category, category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::Narrow | TransformCageSizeCategory::ReducedLandscape 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 // Draw the vertical midpoint drag handles
@@ -586,7 +588,9 @@ impl BoundingBoxManager {
category, category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::Narrow | TransformCageSizeCategory::ReducedPortrait 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 let angle = quad
@@ -601,7 +605,9 @@ impl BoundingBoxManager {
category, category,
TransformCageSizeCategory::Full | TransformCageSizeCategory::ReducedBoth | TransformCageSizeCategory::ReducedLandscape | TransformCageSizeCategory::ReducedPortrait 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 // Draw the flat line endpoint drag handles
+2
View File
@@ -1,3 +1,5 @@
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
/target/ /target/
# Generated by tauri
gen/
File diff suppressed because one or more lines are too long
@@ -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
+1 -1
View File
@@ -46,7 +46,7 @@ wasm-opt = false
[package.metadata.wasm-pack.profile.dev.wasm-bindgen] [package.metadata.wasm-pack.profile.dev.wasm-bindgen]
debug-js-glue = true debug-js-glue = true
demangle-name-section = true demangle-name-section = true
dwarf-debug-info = true dwarf-debug-info = false
[package.metadata.wasm-pack.profile.release] [package.metadata.wasm-pack.profile.release]
wasm-opt = ["-Os", "-g"] wasm-opt = ["-Os", "-g"]
+2 -2
View File
@@ -104,7 +104,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
} }
/// Returns an iterator of the [Bezier]s along the `Subpath`. /// Returns an iterator of the [Bezier]s along the `Subpath`.
pub fn iter(&self) -> SubpathIter<PointId> { pub fn iter(&self) -> SubpathIter<'_, PointId> {
SubpathIter { SubpathIter {
subpath: self, subpath: self,
index: 0, 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. /// 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 { SubpathIter {
subpath: self, subpath: self,
index: 0, index: 0,
+6 -6
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 self.instance
.iter() .iter()
.zip(self.transform.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 self.instance
.iter_mut() .iter_mut()
.zip(self.transform.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() { if index >= self.instance.len() {
return None; 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() { if index >= self.instance.len() {
return None; 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 { InstanceRef {
instance: &self.instance, instance: &self.instance,
transform: &self.transform, 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 { InstanceMut {
instance: &mut self.instance, instance: &mut self.instance,
transform: &mut self.transform, transform: &mut self.transform,
+1 -1
View File
@@ -182,7 +182,7 @@ impl<T: Hash> MemoHash<T> {
hasher.finish() hasher.finish()
} }
pub fn inner_mut(&mut self) -> MemoHashGuard<T> { pub fn inner_mut(&mut self) -> MemoHashGuard<'_, T> {
MemoHashGuard { inner: self } MemoHashGuard { inner: self }
} }
pub fn into_inner(self) -> T { pub fn into_inner(self) -> T {
+1 -1
View File
@@ -208,7 +208,7 @@ pub fn bounding_box(str: &str, buzz_face: Option<&rustybuzz::Face>, typesetting:
bounds 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") rustybuzz::Face::from_slice(data, 0).expect("Loading font failed")
} }
@@ -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()]; 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() { 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)); points[start].set(StrokePathIterPointSegmentMetadata::new(segment_index, false));
+3 -3
View File
@@ -25,11 +25,11 @@ use std::hash::{Hash, Hasher};
/// Implemented for types that can be converted to an iterator of vector data. /// 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 /// Used for the fill and stroke node so they can be used on VectorData or GraphicGroup
trait VectorDataTableIterMut { 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 { 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 // Grab only the direct children
self.instance_mut_iter() self.instance_mut_iter()
.filter_map(|element| element.instance.as_vector_data_mut()) .filter_map(|element| element.instance.as_vector_data_mut())
@@ -38,7 +38,7 @@ impl VectorDataTableIterMut for GraphicGroupTable {
} }
impl VectorDataTableIterMut for VectorDataTable { 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() self.instance_mut_iter()
} }
} }
+2 -2
View File
@@ -389,7 +389,7 @@ impl NodeInput {
pub fn as_value(&self) -> Option<&TaggedValue> { pub fn as_value(&self) -> Option<&TaggedValue> {
if let NodeInput::Value { tagged_value, .. } = self { Some(tagged_value) } else { None } 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 } if let NodeInput::Value { tagged_value, .. } = self { Some(tagged_value.inner_mut()) } else { None }
} }
pub fn as_non_exposed_value(&self) -> Option<&TaggedValue> { 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. /// 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(); let nodes = self.nodes.iter().collect();
RecursiveNodeIter { nodes } RecursiveNodeIter { nodes }
} }
@@ -32,5 +32,5 @@ impl Compiler {
} }
pub trait Executor<I, O> { 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>>>;
} }
@@ -120,7 +120,7 @@ impl<I> Executor<I, TaggedValue> for &DynamicExecutor
where where
I: StaticType + 'static + Send + Sync + std::panic::UnwindSafe, 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 { Box::pin(async move {
use futures::FutureExt; use futures::FutureExt;
@@ -34,7 +34,7 @@ wasm-opt = false
[package.metadata.wasm-pack.profile.dev.wasm-bindgen] [package.metadata.wasm-pack.profile.dev.wasm-bindgen]
debug-js-glue = true debug-js-glue = true
demangle-name-section = true demangle-name-section = true
dwarf-debug-info = true dwarf-debug-info = false
[package.metadata.wasm-pack.profile.release] [package.metadata.wasm-pack.profile.release]
wasm-opt = ["-Oz", "--enable-bulk-memory"] wasm-opt = ["-Oz", "--enable-bulk-memory"]