Skip to content

Commit 3398ebe

Browse files
committed
Use Taplo for TOML formatting
1 parent 21c121f commit 3398ebe

File tree

9 files changed

+164
-160
lines changed

9 files changed

+164
-160
lines changed

.cargo/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#
33
# Note that these flags are (intentionally) not included when building from the downloaded crate.
44
[build]
5-
rustflags = ["--cfg=unreleased_changelogs"]
65
rustdocflags = ["--cfg=unreleased_changelogs"]
6+
rustflags = ["--cfg=unreleased_changelogs"]
77

88
[target.wasm32-unknown-unknown]
99
runner = "wasm-bindgen-test-runner"

.github/workflows/ci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ jobs:
1717
- name: Check Formatting
1818
run: cargo fmt -- --check
1919

20+
taplo:
21+
name: Taplo
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: taiki-e/checkout-action@v1
26+
- name: Install Taplo
27+
uses: taiki-e/install-action@v2
28+
with:
29+
tool: taplo-cli
30+
- name: Run Taplo
31+
run: taplo fmt --check
32+
2033
typos:
2134
name: Check for typos
2235
runs-on: ubuntu-latest

Cargo.toml

+99-110
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
[package]
2-
name = "winit"
3-
version = "0.30.4"
4-
authors = [
5-
"The winit contributors",
6-
"Pierre Krieger <[email protected]>",
7-
]
2+
authors = ["The winit contributors", "Pierre Krieger <[email protected]>"]
3+
categories = ["gui"]
84
description = "Cross-platform window creation library."
9-
keywords = ["windowing"]
10-
readme = "README.md"
115
documentation = "https://docs.rs/winit"
12-
categories = ["gui"]
13-
rust-version.workspace = true
14-
repository.workspace = true
15-
license.workspace = true
166
edition.workspace = true
177
exclude = ["/.cargo"]
8+
keywords = ["windowing"]
9+
license.workspace = true
10+
name = "winit"
11+
readme = "README.md"
12+
repository.workspace = true
13+
rust-version.workspace = true
14+
version = "0.30.4"
1815

1916
[package.metadata.docs.rs]
2017
features = [
@@ -27,6 +24,7 @@ features = [
2724
"android-native-activity",
2825
]
2926
# These are all tested in CI
27+
rustdoc-args = ["--cfg", "docsrs"]
3028
targets = [
3129
# Windows
3230
"i686-pc-windows-msvc",
@@ -43,12 +41,17 @@ targets = [
4341
# Web
4442
"wasm32-unknown-unknown",
4543
]
46-
rustdoc-args = ["--cfg", "docsrs"]
4744

4845
# Features are documented in either `lib.rs` or under `winit::platform`.
4946
[features]
47+
android-game-activity = ["android-activity/game-activity"]
48+
android-native-activity = ["android-activity/native-activity"]
5049
default = ["rwh_06", "x11", "wayland", "wayland-dlopen", "wayland-csd-adwaita"]
51-
x11 = ["x11-dl", "bytemuck", "percent-encoding", "xkbcommon-dl/x11", "x11rb"]
50+
mint = ["dpi/mint"]
51+
rwh_04 = ["dep:rwh_04", "ndk/rwh_04"]
52+
rwh_05 = ["dep:rwh_05", "ndk/rwh_05"]
53+
rwh_06 = ["dep:rwh_06", "ndk/rwh_06"]
54+
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde", "dpi/serde"]
5255
wayland = [
5356
"wayland-client",
5457
"wayland-backend",
@@ -58,17 +61,11 @@ wayland = [
5861
"ahash",
5962
"memmap2",
6063
]
61-
wayland-dlopen = ["wayland-backend/dlopen"]
6264
wayland-csd-adwaita = ["sctk-adwaita", "sctk-adwaita/ab_glyph"]
6365
wayland-csd-adwaita-crossfont = ["sctk-adwaita", "sctk-adwaita/crossfont"]
6466
wayland-csd-adwaita-notitle = ["sctk-adwaita"]
65-
android-native-activity = ["android-activity/native-activity"]
66-
android-game-activity = ["android-activity/game-activity"]
67-
serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde", "dpi/serde"]
68-
mint = ["dpi/mint"]
69-
rwh_04 = ["dep:rwh_04", "ndk/rwh_04"]
70-
rwh_05 = ["dep:rwh_05", "ndk/rwh_05"]
71-
rwh_06 = ["dep:rwh_06", "ndk/rwh_06"]
67+
wayland-dlopen = ["wayland-backend/dlopen"]
68+
x11 = ["x11-dl", "bytemuck", "percent-encoding", "xkbcommon-dl/x11", "x11rb"]
7269

7370
[build-dependencies]
7471
cfg_aliases = "0.2.1"
@@ -78,12 +75,8 @@ bitflags = "2"
7875
cursor-icon = "1.1.0"
7976
dpi = { version = "0.1.1", path = "dpi" }
8077
rwh_04 = { package = "raw-window-handle", version = "0.4", optional = true }
81-
rwh_05 = { package = "raw-window-handle", version = "0.5.2", features = [
82-
"std",
83-
], optional = true }
84-
rwh_06 = { package = "raw-window-handle", version = "0.6", features = [
85-
"std",
86-
], optional = true }
78+
rwh_05 = { package = "raw-window-handle", version = "0.5.2", features = ["std"], optional = true }
79+
rwh_06 = { package = "raw-window-handle", version = "0.6", features = ["std"], optional = true }
8780
serde = { workspace = true, optional = true }
8881
smol_str = "0.2.0"
8982
tracing = { version = "0.1.40", default-features = false }
@@ -114,27 +107,8 @@ objc2 = "0.5.2"
114107

115108
# AppKit
116109
[target.'cfg(target_os = "macos")'.dependencies]
117-
core-graphics = "0.23.1"
118110
block2 = "0.5.1"
119-
objc2-foundation = { version = "0.2.2", features = [
120-
"block2",
121-
"dispatch",
122-
"NSArray",
123-
"NSAttributedString",
124-
"NSData",
125-
"NSDictionary",
126-
"NSDistributedNotificationCenter",
127-
"NSEnumerator",
128-
"NSKeyValueObserving",
129-
"NSNotification",
130-
"NSObjCRuntime",
131-
"NSPathUtilities",
132-
"NSProcessInfo",
133-
"NSRunLoop",
134-
"NSString",
135-
"NSThread",
136-
"NSValue",
137-
] }
111+
core-graphics = "0.23.1"
138112
objc2-app-kit = { version = "0.2.2", features = [
139113
"NSAppearance",
140114
"NSApplication",
@@ -163,6 +137,25 @@ objc2-app-kit = { version = "0.2.2", features = [
163137
"NSWindowScripting",
164138
"NSWindowTabGroup",
165139
] }
140+
objc2-foundation = { version = "0.2.2", features = [
141+
"block2",
142+
"dispatch",
143+
"NSArray",
144+
"NSAttributedString",
145+
"NSData",
146+
"NSDictionary",
147+
"NSDistributedNotificationCenter",
148+
"NSEnumerator",
149+
"NSKeyValueObserving",
150+
"NSNotification",
151+
"NSObjCRuntime",
152+
"NSPathUtilities",
153+
"NSProcessInfo",
154+
"NSRunLoop",
155+
"NSString",
156+
"NSThread",
157+
"NSValue",
158+
] }
166159

167160
# UIKit
168161
[target.'cfg(all(target_vendor = "apple", not(target_os = "macos")))'.dependencies]
@@ -250,12 +243,8 @@ wayland-backend = { version = "0.3.5", default-features = false, features = [
250243
"client_system",
251244
], optional = true }
252245
wayland-client = { version = "0.31.4", optional = true }
253-
wayland-protocols = { version = "0.32.2", features = [
254-
"staging",
255-
], optional = true }
256-
wayland-protocols-plasma = { version = "0.3.2", features = [
257-
"client",
258-
], optional = true }
246+
wayland-protocols = { version = "0.32.2", features = ["staging"], optional = true }
247+
wayland-protocols-plasma = { version = "0.3.2", features = ["client"], optional = true }
259248
x11-dl = { version = "2.19.1", optional = true }
260249
x11rb = { version = "0.13.0", default-features = false, features = [
261250
"allow-unsafe-code",
@@ -275,62 +264,62 @@ redox_syscall = "0.4.1"
275264

276265
# Web
277266
[target.'cfg(target_family = "wasm")'.dependencies]
278-
web_sys = { package = "web-sys", version = "0.3.64", features = [
279-
'AbortController',
280-
'AbortSignal',
281-
'Blob',
282-
'BlobPropertyBag',
283-
'console',
284-
'CssStyleDeclaration',
285-
'Document',
286-
'DomException',
287-
'DomRect',
288-
'DomRectReadOnly',
289-
'Element',
290-
'Event',
291-
'EventTarget',
292-
'FocusEvent',
293-
'HtmlCanvasElement',
294-
'HtmlElement',
295-
'HtmlImageElement',
296-
'ImageBitmap',
297-
'ImageBitmapOptions',
298-
'ImageBitmapRenderingContext',
299-
'ImageData',
300-
'IntersectionObserver',
301-
'IntersectionObserverEntry',
302-
'KeyboardEvent',
303-
'MediaQueryList',
304-
'MessageChannel',
305-
'MessagePort',
306-
'Navigator',
307-
'Node',
308-
'OrientationType',
309-
'OrientationLockType',
310-
'PageTransitionEvent',
311-
'Permissions',
312-
'PermissionState',
313-
'PermissionStatus',
314-
'PointerEvent',
315-
'PremultiplyAlpha',
316-
'ResizeObserver',
317-
'ResizeObserverBoxOptions',
318-
'ResizeObserverEntry',
319-
'ResizeObserverOptions',
320-
'ResizeObserverSize',
321-
'Screen',
322-
'ScreenOrientation',
323-
'VisibilityState',
324-
'Window',
325-
'WheelEvent',
326-
'Worker',
327-
'Url',
328-
] }
329267
js-sys = "0.3.64"
330268
pin-project = "1"
331269
wasm-bindgen = "0.2"
332270
wasm-bindgen-futures = "0.4"
333271
web-time = "1"
272+
web_sys = { package = "web-sys", version = "0.3.64", features = [
273+
"AbortController",
274+
"AbortSignal",
275+
"Blob",
276+
"BlobPropertyBag",
277+
"console",
278+
"CssStyleDeclaration",
279+
"Document",
280+
"DomException",
281+
"DomRect",
282+
"DomRectReadOnly",
283+
"Element",
284+
"Event",
285+
"EventTarget",
286+
"FocusEvent",
287+
"HtmlCanvasElement",
288+
"HtmlElement",
289+
"HtmlImageElement",
290+
"ImageBitmap",
291+
"ImageBitmapOptions",
292+
"ImageBitmapRenderingContext",
293+
"ImageData",
294+
"IntersectionObserver",
295+
"IntersectionObserverEntry",
296+
"KeyboardEvent",
297+
"MediaQueryList",
298+
"MessageChannel",
299+
"MessagePort",
300+
"Navigator",
301+
"Node",
302+
"OrientationLockType",
303+
"OrientationType",
304+
"PageTransitionEvent",
305+
"Permissions",
306+
"PermissionState",
307+
"PermissionStatus",
308+
"PointerEvent",
309+
"PremultiplyAlpha",
310+
"ResizeObserver",
311+
"ResizeObserverBoxOptions",
312+
"ResizeObserverEntry",
313+
"ResizeObserverOptions",
314+
"ResizeObserverSize",
315+
"Screen",
316+
"ScreenOrientation",
317+
"Url",
318+
"VisibilityState",
319+
"WheelEvent",
320+
"Window",
321+
"Worker",
322+
] }
334323

335324
[target.'cfg(all(target_family = "wasm", target_feature = "atomics"))'.dependencies]
336325
atomic-waker = "1"
@@ -346,15 +335,15 @@ doc-scrape-examples = true
346335
name = "window"
347336

348337
[workspace]
349-
resolver = "2"
350338
members = ["dpi"]
339+
resolver = "2"
351340

352341
[workspace.package]
353-
rust-version = "1.73"
354-
repository = "https://github.com/rust-windowing/winit"
355-
license = "Apache-2.0"
356342
edition = "2021"
343+
license = "Apache-2.0"
344+
repository = "https://github.com/rust-windowing/winit"
345+
rust-version = "1.73"
357346

358347
[workspace.dependencies]
359-
serde = { version = "1", features = ["serde_derive"] }
360348
mint = "0.5.6"
349+
serde = { version = "1", features = ["serde_derive"] }

clippy.toml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
disallowed-methods = [
2-
{ path = "web_sys::window", reason = "is not available in every context" },
3-
{ path = "web_sys::HtmlCanvasElement::width", reason = "Winit shouldn't touch the internal canvas size" },
2+
{ path = "objc2_app_kit::NSView::visibleRect", reason = "We expose a render target to the user, and visibility is not really relevant to that (and can break if you don't use the rectangle position as well). Use `frame` instead." },
3+
{ path = "objc2_app_kit::NSWindow::setFrameTopLeftPoint", reason = "Not sufficient when working with Winit's coordinate system, use `flip_window_screen_coordinates` instead" },
4+
{ path = "web_sys::Document::exit_fullscreen", reason = "Doesn't account for compatibility with Safari" },
5+
{ path = "web_sys::Document::fullscreen_element", reason = "Doesn't account for compatibility with Safari" },
6+
{ path = "web_sys::Element::request_fullscreen", reason = "Doesn't account for compatibility with Safari" },
47
{ path = "web_sys::HtmlCanvasElement::height", reason = "Winit shouldn't touch the internal canvas size" },
5-
{ path = "web_sys::HtmlCanvasElement::set_width", reason = "Winit shouldn't touch the internal canvas size" },
68
{ path = "web_sys::HtmlCanvasElement::set_height", reason = "Winit shouldn't touch the internal canvas size" },
7-
{ path = "web_sys::Window::navigator", reason = "cache this to reduce calls to JS" },
9+
{ path = "web_sys::HtmlCanvasElement::set_width", reason = "Winit shouldn't touch the internal canvas size" },
10+
{ path = "web_sys::HtmlCanvasElement::width", reason = "Winit shouldn't touch the internal canvas size" },
11+
{ path = "web_sys::HtmlElement::style", reason = "cache this to reduce calls to JS" },
812
{ path = "web_sys::Window::document", reason = "cache this to reduce calls to JS" },
913
{ path = "web_sys::Window::get_computed_style", reason = "cache this to reduce calls to JS" },
10-
{ path = "web_sys::HtmlElement::style", reason = "cache this to reduce calls to JS" },
11-
{ path = "web_sys::Element::request_fullscreen", reason = "Doesn't account for compatibility with Safari" },
12-
{ path = "web_sys::Document::exit_fullscreen", reason = "Doesn't account for compatibility with Safari" },
13-
{ path = "web_sys::Document::fullscreen_element", reason = "Doesn't account for compatibility with Safari" },
14-
{ path = "objc2_app_kit::NSView::visibleRect", reason = "We expose a render target to the user, and visibility is not really relevant to that (and can break if you don't use the rectangle position as well). Use `frame` instead." },
15-
{ path = "objc2_app_kit::NSWindow::setFrameTopLeftPoint", reason = "Not sufficient when working with Winit's coordinate system, use `flip_window_screen_coordinates` instead" },
14+
{ path = "web_sys::Window::navigator", reason = "cache this to reduce calls to JS" },
15+
{ path = "web_sys::window", reason = "is not available in every context" },
1616
]

0 commit comments

Comments
 (0)