From 547412b14d7abae64a16e54f5d1a6b5e1c9529db Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Wed, 11 Dec 2024 15:18:19 +0100 Subject: [PATCH 1/7] Add TOML formatting with Taplo Add Taplo config. Format TOM config files. Add Taplo step to CI. --- .taplo.toml | 8 ++++++++ .typos.toml | 20 ++++++++++---------- Cargo.toml | 9 ++------- masonry/Cargo.toml | 10 +++++----- xilem/Cargo.toml | 13 ++++--------- xilem_web/Cargo.toml | 2 +- 6 files changed, 30 insertions(+), 32 deletions(-) create mode 100644 .taplo.toml diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 000000000..ca9c94e9f --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,8 @@ +[formatting] +# This is a matter of taste, but expanded inline arrays make tables harder to read. +array_auto_collapse = true +inline_table_expand = false + +# Aligning comments with the largest line creates +# diff noise when neighboring lines are changed. +align_comments = false diff --git a/.typos.toml b/.typos.toml index d310a233b..f4b66bb95 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,12 +3,12 @@ [default] extend-ignore-re = [ - # Matches lorem ipsum text. - # In general, regexes are only matched until the end of a line by typos, - # and the repeated matcher at the end of both of these also ensures that - # matching ends at quotes or symbols commonly used to terminate comments. - "Lorem ipsum [a-zA-Z .,]*", - "Phasellus in viverra dolor [a-zA-Z .,]*", + # Matches lorem ipsum text. + # In general, regexes are only matched until the end of a line by typos, + # and the repeated matcher at the end of both of these also ensures that + # matching ends at quotes or symbols commonly used to terminate comments. + "Lorem ipsum [a-zA-Z .,]*", + "Phasellus in viverra dolor [a-zA-Z .,]*", ] # Corrections take the form of a key/value pair. The key is the incorrect word @@ -28,8 +28,8 @@ seeked = "seeked" # Part of the HTML standard # Include .github, .cargo, etc. ignore-hidden = false extend-exclude = [ - "masonry/resources/i18n", - # /.git isn't in .gitignore, because git never tracks it. - # Typos doesn't know that, though. - "/.git", + "masonry/resources/i18n", + # /.git isn't in .gitignore, because git never tracks it. + # Typos doesn't know that, though. + "/.git", ] diff --git a/Cargo.toml b/Cargo.toml index 4924394cf..33f3f4512 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,10 +35,7 @@ homepage = "https://xilem.dev/" rust.unsafe_code = "deny" # Intentional break from the lint set. Intended to be temporary -rust.unexpected_cfgs = { level = "warn", check-cfg = [ - 'cfg(FALSE)', - 'cfg(tarpaulin_include)', -] } +rust.unexpected_cfgs = { level = "warn", check-cfg = ['cfg(FALSE)', 'cfg(tarpaulin_include)'] } # LINEBENDER LINT SET - Cargo.toml - v2 # See https://linebender.org/wiki/canonical-lints/ @@ -110,9 +107,7 @@ tree_arena = { version = "0.1.0", path = "tree_arena" } vello = "0.3" wgpu = "22.1.0" kurbo = "0.11.1" -parley = { git = "https://github.com/linebender/parley", rev = "1a8740d8d86ebf751201e45e89bb71019340137d", features = [ - "accesskit", -] } +parley = { git = "https://github.com/linebender/parley", rev = "1a8740d8d86ebf751201e45e89bb71019340137d", features = ["accesskit"] } peniko = "0.2.0" winit = "0.30.4" tracing = { version = "0.1.40", default-features = false } diff --git a/masonry/Cargo.toml b/masonry/Cargo.toml index 4d17534db..934e04074 100644 --- a/masonry/Cargo.toml +++ b/masonry/Cargo.toml @@ -24,11 +24,11 @@ default = [] # Enables tracing using tracy if the default Masonry tracing is used. # https://github.com/wolfpld/tracy can be connected to when this feature is enabled. tracy = [ - "tracing-tracy/enable", - "dep:tracing-tracy", - "dep:wgpu-profiler", - "wgpu-profiler/tracy", - "vello/wgpu-profiler", + "tracing-tracy/enable", + "dep:tracing-tracy", + "dep:wgpu-profiler", + "wgpu-profiler/tracy", + "vello/wgpu-profiler", ] [lints] diff --git a/xilem/Cargo.toml b/xilem/Cargo.toml index 8acbb7a22..da61ce8eb 100644 --- a/xilem/Cargo.toml +++ b/xilem/Cargo.toml @@ -89,12 +89,7 @@ tracing.workspace = true vello.workspace = true smallvec.workspace = true accesskit.workspace = true -tokio = { version = "1.39.1", features = [ - "rt", - "rt-multi-thread", - "time", - "sync", -] } +tokio = { version = "1.39.1", features = ["rt", "rt-multi-thread", "time", "sync"] } [dev-dependencies] # Used for `variable_clock` @@ -102,9 +97,9 @@ time = { workspace = true, features = ["local-offset"] } # Used for http_cats reqwest = { version = "0.12.7", default-features = false, features = [ - # We use rustls as Android doesn't ship with openssl - # and this is likely to be easiest to get working. - "rustls-tls", + # We use rustls as Android doesn't ship with openssl + # and this is likely to be easiest to get working. + "rustls-tls", ] } image = { workspace = true, features = ["jpeg"] } diff --git a/xilem_web/Cargo.toml b/xilem_web/Cargo.toml index 54b21a116..2f61c34c6 100644 --- a/xilem_web/Cargo.toml +++ b/xilem_web/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "HTML DOM frontend for the Xilem Rust UI framework." keywords = ["xilem", "html", "svg", "dom", "web", "ui"] categories = ["gui", "web-programming"] -publish = false # Until it's ready +publish = false # Until it's ready edition.workspace = true license.workspace = true repository.workspace = true From 3a4b8594ec2a2da94e3d4811b20ffc2e7b921b14 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Wed, 11 Dec 2024 15:20:38 +0100 Subject: [PATCH 2/7] Add link to taplo doc Add CI step --- .github/workflows/ci.yml | 8 ++++++++ .taplo.toml | 3 +++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a25291cd3..c20e686b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,6 +79,14 @@ jobs: - name: Run cargo fmt run: cargo fmt --all --check + - name: Install Taplo + uses: uncenter/setup-taplo@v1 + with: + version: "0.9.3" + + - name: run `taplo fmt` + run: taplo fmt --check --diff + - name: Install ripgrep run: | sudo apt update diff --git a/.taplo.toml b/.taplo.toml index ca9c94e9f..2a604f18c 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -1,3 +1,6 @@ +# See https://taplo.tamasfe.dev/configuration/file.html +# and https://taplo.tamasfe.dev/configuration/formatter-options.html + [formatting] # This is a matter of taste, but expanded inline arrays make tables harder to read. array_auto_collapse = true From 4393919e137e420ac45113b1f76102c525947f41 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 12 Dec 2024 15:55:44 +0100 Subject: [PATCH 3/7] Match rustfmt formatting style --- .taplo.toml | 4 + .typos.toml | 20 +-- masonry/Cargo.toml | 10 +- xilem/Cargo.toml | 6 +- xilem_web/Cargo.toml | 292 +++++++++++++++++++++---------------------- 5 files changed, 168 insertions(+), 164 deletions(-) diff --git a/.taplo.toml b/.taplo.toml index 2a604f18c..98540bce8 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -9,3 +9,7 @@ inline_table_expand = false # Aligning comments with the largest line creates # diff noise when neighboring lines are changed. align_comments = false + +# Matches how rustfmt formats Rust code +column_width = 100 +indent_string = " " diff --git a/.typos.toml b/.typos.toml index f4b66bb95..d310a233b 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,12 +3,12 @@ [default] extend-ignore-re = [ - # Matches lorem ipsum text. - # In general, regexes are only matched until the end of a line by typos, - # and the repeated matcher at the end of both of these also ensures that - # matching ends at quotes or symbols commonly used to terminate comments. - "Lorem ipsum [a-zA-Z .,]*", - "Phasellus in viverra dolor [a-zA-Z .,]*", + # Matches lorem ipsum text. + # In general, regexes are only matched until the end of a line by typos, + # and the repeated matcher at the end of both of these also ensures that + # matching ends at quotes or symbols commonly used to terminate comments. + "Lorem ipsum [a-zA-Z .,]*", + "Phasellus in viverra dolor [a-zA-Z .,]*", ] # Corrections take the form of a key/value pair. The key is the incorrect word @@ -28,8 +28,8 @@ seeked = "seeked" # Part of the HTML standard # Include .github, .cargo, etc. ignore-hidden = false extend-exclude = [ - "masonry/resources/i18n", - # /.git isn't in .gitignore, because git never tracks it. - # Typos doesn't know that, though. - "/.git", + "masonry/resources/i18n", + # /.git isn't in .gitignore, because git never tracks it. + # Typos doesn't know that, though. + "/.git", ] diff --git a/masonry/Cargo.toml b/masonry/Cargo.toml index 934e04074..4d17534db 100644 --- a/masonry/Cargo.toml +++ b/masonry/Cargo.toml @@ -24,11 +24,11 @@ default = [] # Enables tracing using tracy if the default Masonry tracing is used. # https://github.com/wolfpld/tracy can be connected to when this feature is enabled. tracy = [ - "tracing-tracy/enable", - "dep:tracing-tracy", - "dep:wgpu-profiler", - "wgpu-profiler/tracy", - "vello/wgpu-profiler", + "tracing-tracy/enable", + "dep:tracing-tracy", + "dep:wgpu-profiler", + "wgpu-profiler/tracy", + "vello/wgpu-profiler", ] [lints] diff --git a/xilem/Cargo.toml b/xilem/Cargo.toml index da61ce8eb..dc60c831a 100644 --- a/xilem/Cargo.toml +++ b/xilem/Cargo.toml @@ -97,9 +97,9 @@ time = { workspace = true, features = ["local-offset"] } # Used for http_cats reqwest = { version = "0.12.7", default-features = false, features = [ - # We use rustls as Android doesn't ship with openssl - # and this is likely to be easiest to get working. - "rustls-tls", + # We use rustls as Android doesn't ship with openssl + # and this is likely to be easiest to get working. + "rustls-tls", ] } image = { workspace = true, features = ["jpeg"] } diff --git a/xilem_web/Cargo.toml b/xilem_web/Cargo.toml index 2f61c34c6..600af196c 100644 --- a/xilem_web/Cargo.toml +++ b/xilem_web/Cargo.toml @@ -30,152 +30,152 @@ xilem_core = { workspace = true, features = ["kurbo"] } [dependencies.web-sys] version = "0.3.69" features = [ - "console", - "CssStyleDeclaration", - "Document", - "DocumentFragment", - "DomTokenList", - "Element", - "Event", - "AddEventListenerOptions", - "HtmlElement", - "Node", - "NodeList", - "ResizeObserver", - "ResizeObserverEntry", - "DomRectReadOnly", - "MathMlElement", - "SvgElement", - "SvgaElement", - "SvgAnimateElement", - "SvgAnimateMotionElement", - "SvgAnimateTransformElement", - "SvgCircleElement", - "SvgClipPathElement", - "SvgDefsElement", - "SvgDescElement", - "SvgEllipseElement", - "SvgfeBlendElement", - "SvgfeColorMatrixElement", - "SvgfeComponentTransferElement", - "SvgfeCompositeElement", - "SvgfeConvolveMatrixElement", - "SvgfeDiffuseLightingElement", - "SvgfeDisplacementMapElement", - "SvgfeDistantLightElement", - "SvgfeDropShadowElement", - "SvgfeFloodElement", - "SvgfeFuncAElement", - "SvgfeFuncBElement", - "SvgfeFuncGElement", - "SvgfeFuncRElement", - "SvgfeGaussianBlurElement", - "SvgfeImageElement", - "SvgfeMergeElement", - "SvgfeMergeNodeElement", - "SvgfeMorphologyElement", - "SvgfeOffsetElement", - "SvgfePointLightElement", - "SvgfeSpecularLightingElement", - "SvgfeSpotLightElement", - "SvgfeTileElement", - "SvgfeTurbulenceElement", - "SvgFilterElement", - "SvgForeignObjectElement", - "SvggElement", - # "SvgHatchElement", - # "SvgHatchpathElement", - "SvgImageElement", - "SvgLineElement", - "SvgLinearGradientElement", - "SvgMarkerElement", - "SvgMaskElement", - "SvgMetadataElement", - "SvgmPathElement", - "SvgPathElement", - "SvgPatternElement", - "SvgPolygonElement", - "SvgPolylineElement", - "SvgRadialGradientElement", - "SvgRectElement", - "SvgScriptElement", - "SvgSetElement", - "SvgStopElement", - "SvgStyleElement", - "SvgsvgElement", - "SvgSwitchElement", - "SvgSymbolElement", - "SvgTextElement", - "SvgTextPathElement", - "SvgTitleElement", - "SvgtSpanElement", - "SvgUseElement", - "SvgViewElement", - "Text", - "Window", - "FocusEvent", - "HtmlInputElement", - "InputEvent", - "KeyboardEvent", - "MouseEvent", - "PointerEvent", - "WheelEvent", - "HtmlAnchorElement", - "HtmlAreaElement", - "HtmlAudioElement", - "HtmlBrElement", - "HtmlButtonElement", - "HtmlCanvasElement", - "HtmlDataElement", - "HtmlDataListElement", - "HtmlDetailsElement", - "HtmlDialogElement", - "HtmlDivElement", - "HtmlDListElement", - "HtmlEmbedElement", - "HtmlFieldSetElement", - "HtmlFormElement", - "HtmlHeadingElement", - "HtmlHrElement", - "HtmlIFrameElement", - "HtmlImageElement", - "HtmlInputElement", - "HtmlLabelElement", - "HtmlLegendElement", - "HtmlLiElement", - "HtmlLinkElement", - "HtmlMapElement", - "HtmlMediaElement", - "HtmlMenuElement", - "HtmlMeterElement", - "HtmlModElement", - "HtmlObjectElement", - "HtmlOListElement", - "HtmlOptGroupElement", - "HtmlOptionElement", - "HtmlOutputElement", - "HtmlParagraphElement", - "HtmlPictureElement", - "HtmlPreElement", - "HtmlProgressElement", - "HtmlQuoteElement", - "HtmlScriptElement", - "HtmlSelectElement", - "HtmlSlotElement", - "HtmlSourceElement", - "HtmlSpanElement", - "HtmlTableCaptionElement", - "HtmlTableCellElement", - "HtmlTableColElement", - "HtmlTableElement", - "HtmlTableRowElement", - "HtmlTableSectionElement", - "HtmlTemplateElement", - "HtmlTimeElement", - "HtmlTextAreaElement", - "HtmlTrackElement", - "HtmlUListElement", - "HtmlVideoElement", + "console", + "CssStyleDeclaration", + "Document", + "DocumentFragment", + "DomTokenList", + "Element", + "Event", + "AddEventListenerOptions", + "HtmlElement", + "Node", + "NodeList", + "ResizeObserver", + "ResizeObserverEntry", + "DomRectReadOnly", + "MathMlElement", + "SvgElement", + "SvgaElement", + "SvgAnimateElement", + "SvgAnimateMotionElement", + "SvgAnimateTransformElement", + "SvgCircleElement", + "SvgClipPathElement", + "SvgDefsElement", + "SvgDescElement", + "SvgEllipseElement", + "SvgfeBlendElement", + "SvgfeColorMatrixElement", + "SvgfeComponentTransferElement", + "SvgfeCompositeElement", + "SvgfeConvolveMatrixElement", + "SvgfeDiffuseLightingElement", + "SvgfeDisplacementMapElement", + "SvgfeDistantLightElement", + "SvgfeDropShadowElement", + "SvgfeFloodElement", + "SvgfeFuncAElement", + "SvgfeFuncBElement", + "SvgfeFuncGElement", + "SvgfeFuncRElement", + "SvgfeGaussianBlurElement", + "SvgfeImageElement", + "SvgfeMergeElement", + "SvgfeMergeNodeElement", + "SvgfeMorphologyElement", + "SvgfeOffsetElement", + "SvgfePointLightElement", + "SvgfeSpecularLightingElement", + "SvgfeSpotLightElement", + "SvgfeTileElement", + "SvgfeTurbulenceElement", + "SvgFilterElement", + "SvgForeignObjectElement", + "SvggElement", + # "SvgHatchElement", + # "SvgHatchpathElement", + "SvgImageElement", + "SvgLineElement", + "SvgLinearGradientElement", + "SvgMarkerElement", + "SvgMaskElement", + "SvgMetadataElement", + "SvgmPathElement", + "SvgPathElement", + "SvgPatternElement", + "SvgPolygonElement", + "SvgPolylineElement", + "SvgRadialGradientElement", + "SvgRectElement", + "SvgScriptElement", + "SvgSetElement", + "SvgStopElement", + "SvgStyleElement", + "SvgsvgElement", + "SvgSwitchElement", + "SvgSymbolElement", + "SvgTextElement", + "SvgTextPathElement", + "SvgTitleElement", + "SvgtSpanElement", + "SvgUseElement", + "SvgViewElement", + "Text", + "Window", + "FocusEvent", + "HtmlInputElement", + "InputEvent", + "KeyboardEvent", + "MouseEvent", + "PointerEvent", + "WheelEvent", + "HtmlAnchorElement", + "HtmlAreaElement", + "HtmlAudioElement", + "HtmlBrElement", + "HtmlButtonElement", + "HtmlCanvasElement", + "HtmlDataElement", + "HtmlDataListElement", + "HtmlDetailsElement", + "HtmlDialogElement", + "HtmlDivElement", + "HtmlDListElement", + "HtmlEmbedElement", + "HtmlFieldSetElement", + "HtmlFormElement", + "HtmlHeadingElement", + "HtmlHrElement", + "HtmlIFrameElement", + "HtmlImageElement", + "HtmlInputElement", + "HtmlLabelElement", + "HtmlLegendElement", + "HtmlLiElement", + "HtmlLinkElement", + "HtmlMapElement", + "HtmlMediaElement", + "HtmlMenuElement", + "HtmlMeterElement", + "HtmlModElement", + "HtmlObjectElement", + "HtmlOListElement", + "HtmlOptGroupElement", + "HtmlOptionElement", + "HtmlOutputElement", + "HtmlParagraphElement", + "HtmlPictureElement", + "HtmlPreElement", + "HtmlProgressElement", + "HtmlQuoteElement", + "HtmlScriptElement", + "HtmlSelectElement", + "HtmlSlotElement", + "HtmlSourceElement", + "HtmlSpanElement", + "HtmlTableCaptionElement", + "HtmlTableCellElement", + "HtmlTableColElement", + "HtmlTableElement", + "HtmlTableRowElement", + "HtmlTableSectionElement", + "HtmlTemplateElement", + "HtmlTimeElement", + "HtmlTextAreaElement", + "HtmlTrackElement", + "HtmlUListElement", + "HtmlVideoElement", ] [features] From 62f7280d6b55cdd40c3cbe849bf1e65e0d040bf8 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 12 Dec 2024 16:27:41 +0100 Subject: [PATCH 4/7] Fix ci config --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c20e686b2..3d8935cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,11 +80,11 @@ jobs: run: cargo fmt --all --check - name: Install Taplo - uses: uncenter/setup-taplo@v1 + uses: uncenter/setup-taplo@09968a8ae38d66ddd3d23802c44bf6122d7aa991 with: version: "0.9.3" - - name: run `taplo fmt` + - name: Run `taplo fmt` run: taplo fmt --check --diff - name: Install ripgrep From 1659dcd9bc7bcfcdff4326fdc1e91a948f20d166 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 12 Dec 2024 16:28:31 +0100 Subject: [PATCH 5/7] Add small comment --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d8935cf3..31d24803b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: run: cargo fmt --all --check - name: Install Taplo - uses: uncenter/setup-taplo@09968a8ae38d66ddd3d23802c44bf6122d7aa991 + uses: uncenter/setup-taplo@09968a8ae38d66ddd3d23802c44bf6122d7aa991 # v1 with: version: "0.9.3" From 0cf4091f0b8936942dcc61c1fd583236756531a2 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 12 Dec 2024 16:30:55 +0100 Subject: [PATCH 6/7] Remove inline-table-related configs --- .taplo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.taplo.toml b/.taplo.toml index 98540bce8..f01304619 100644 --- a/.taplo.toml +++ b/.taplo.toml @@ -2,10 +2,6 @@ # and https://taplo.tamasfe.dev/configuration/formatter-options.html [formatting] -# This is a matter of taste, but expanded inline arrays make tables harder to read. -array_auto_collapse = true -inline_table_expand = false - # Aligning comments with the largest line creates # diff noise when neighboring lines are changed. align_comments = false From ab5adf59e6d7af4b1f30de319d4464d937eda142 Mon Sep 17 00:00:00 2001 From: Olivier FAURE Date: Thu, 12 Dec 2024 17:11:47 +0100 Subject: [PATCH 7/7] Small fixes --- .github/workflows/ci.yml | 2 +- Cargo.toml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31d24803b..0fb610dea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: with: version: "0.9.3" - - name: Run `taplo fmt` + - name: Run taplo fmt run: taplo fmt --check --diff - name: Install ripgrep diff --git a/Cargo.toml b/Cargo.toml index 33f3f4512..51c3a09d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,7 +107,9 @@ tree_arena = { version = "0.1.0", path = "tree_arena" } vello = "0.3" wgpu = "22.1.0" kurbo = "0.11.1" -parley = { git = "https://github.com/linebender/parley", rev = "1a8740d8d86ebf751201e45e89bb71019340137d", features = ["accesskit"] } +parley = { git = "https://github.com/linebender/parley", rev = "1a8740d8d86ebf751201e45e89bb71019340137d", features = [ + "accesskit", +] } peniko = "0.2.0" winit = "0.30.4" tracing = { version = "0.1.40", default-features = false }