Skip to content

Commit 68abf68

Browse files
committed
Reformat all Rust imports
1 parent 9d4a3b0 commit 68abf68

File tree

172 files changed

+757
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+757
-822
lines changed

crates/ecolor/src/cint_impl.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use super::{Color32, Hsva, HsvaGamma, Rgba, linear_f32_from_linear_u8, linear_u8_from_linear_f32};
21
use cint::{Alpha, ColorInterop, EncodedSrgb, Hsv, LinearSrgb, PremultipliedAlpha};
32

3+
use super::{Color32, Hsva, HsvaGamma, Rgba, linear_f32_from_linear_u8, linear_u8_from_linear_f32};
4+
45
// ---- Color32 ----
56

67
impl From<Alpha<EncodedSrgb<u8>>> for Color32 {

crates/ecolor/src/hex_color_runtime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
//! Supports the 3, 4, 6, and 8-digit formats, according to the specification in
44
//! <https://drafts.csswg.org/css-color-4/#hex-color>
55
6-
use std::{fmt::Display, str::FromStr};
6+
use std::fmt::Display;
7+
use std::str::FromStr;
78

89
use crate::Color32;
910

@@ -170,8 +171,7 @@ mod tests {
170171

171172
#[test]
172173
fn hex_string_formats() {
173-
use Color32 as C;
174-
use HexColor as H;
174+
use {Color32 as C, HexColor as H};
175175
let cases = [
176176
(H::Hex3(C::RED), "#f00"),
177177
(H::Hex4(C::RED), "#f00f"),

crates/eframe/src/epi.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
#[cfg(target_arch = "wasm32")]
1010
use std::any::Any;
1111

12-
#[cfg(not(target_arch = "wasm32"))]
13-
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
14-
pub use crate::native::winit_integration::UserEvent;
15-
1612
#[cfg(not(target_arch = "wasm32"))]
1713
use raw_window_handle::{
1814
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
1915
RawWindowHandle, WindowHandle,
2016
};
2117
#[cfg(not(target_arch = "wasm32"))]
2218
use static_assertions::assert_not_impl_any;
23-
2419
#[cfg(not(target_arch = "wasm32"))]
2520
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
2621
pub use winit::{event_loop::EventLoopBuilder, window::WindowAttributes};
2722

23+
#[cfg(not(target_arch = "wasm32"))]
24+
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
25+
pub use crate::native::winit_integration::UserEvent;
26+
2827
/// Hook into the building of an event loop before it is run
2928
///
3029
/// You can configure any platform specific details required on top of the default configuration

crates/eframe/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,10 @@
154154
compile_error!("`accesskit` feature is only available with `android-game-activity`");
155155

156156
// Re-export all useful libraries:
157-
pub use {egui, egui::emath, egui::epaint};
158-
157+
pub use egui;
158+
pub use egui::{emath, epaint};
159159
#[cfg(feature = "glow")]
160160
pub use {egui_glow, glow};
161-
162161
#[cfg(feature = "wgpu_no_default_features")]
163162
pub use {egui_wgpu, wgpu};
164163

@@ -174,7 +173,6 @@ pub(crate) mod stopwatch;
174173

175174
#[cfg(target_arch = "wasm32")]
176175
pub use wasm_bindgen;
177-
178176
#[cfg(target_arch = "wasm32")]
179177
pub use web_sys;
180178

@@ -193,16 +191,14 @@ mod native;
193191

194192
#[cfg(not(target_arch = "wasm32"))]
195193
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
196-
pub use native::run::EframeWinitApplication;
197-
194+
#[cfg(feature = "persistence")]
195+
pub use native::file_storage::storage_dir;
198196
#[cfg(not(any(target_arch = "wasm32", target_os = "ios")))]
199197
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
200198
pub use native::run::EframePumpStatus;
201-
202199
#[cfg(not(target_arch = "wasm32"))]
203200
#[cfg(any(feature = "glow", feature = "wgpu_no_default_features"))]
204-
#[cfg(feature = "persistence")]
205-
pub use native::file_storage::storage_dir;
201+
pub use native::run::EframeWinitApplication;
206202

207203
#[cfg(not(target_arch = "wasm32"))]
208204
pub mod icon_data;

crates/eframe/src/native/app_icon.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ fn set_title_and_icon(_title: &str, _icon_data: Option<&IconData>) -> AppIconSta
7979
#[cfg(target_os = "windows")]
8080
#[expect(unsafe_code)]
8181
fn set_app_icon_windows(icon_data: &IconData) -> AppIconStatus {
82-
use crate::icon_data::IconDataExt as _;
8382
use windows_sys::Win32::UI::Input::KeyboardAndMouse::GetActiveWindow;
8483
use windows_sys::Win32::UI::WindowsAndMessaging::{
8584
CreateIconFromResourceEx, GetSystemMetrics, HICON, ICON_BIG, ICON_SMALL, LR_DEFAULTCOLOR,
8685
SM_CXICON, SM_CXSMICON, SendMessageW, WM_SETICON,
8786
};
8887

88+
use crate::icon_data::IconDataExt as _;
89+
8990
// We would get fairly far already with winit's `set_window_icon` (which is exposed to eframe) actually!
9091
// However, it only sets ICON_SMALL, i.e. doesn't allow us to set a higher resolution icon for the task bar.
9192
// Also, there is scaling issues, detailed below.

crates/eframe/src/native/epi_integration.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
//! Common tools used by [`super::glow_integration`] and [`super::wgpu_integration`].
22
3-
use web_time::Instant;
4-
53
use std::path::PathBuf;
6-
use winit::event_loop::ActiveEventLoop;
7-
8-
use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _};
94

105
use egui::{DeferredViewportUiCallback, ViewportBuilder, ViewportId};
116
use egui_winit::{EventResponse, WindowSettings};
7+
use raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _};
8+
use web_time::Instant;
9+
use winit::event_loop::ActiveEventLoop;
1210

1311
use crate::epi;
1412

crates/eframe/src/native/event_loop_context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::cell::Cell;
2+
23
use winit::event_loop::ActiveEventLoop;
34

45
thread_local! {

crates/eframe/src/native/file_storage.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use std::{
2-
collections::HashMap,
3-
io::Write as _,
4-
path::{Path, PathBuf},
5-
};
1+
use std::collections::HashMap;
2+
use std::io::Write as _;
3+
use std::path::{Path, PathBuf};
64

75
/// The folder where `eframe` will store its state.
86
///
@@ -15,8 +13,9 @@ use std::{
1513
/// * macOS: `/Users/UserName/Library/Application Support/APP_ID`
1614
/// * Windows: `C:\Users\UserName\AppData\Roaming\APP_ID\data`
1715
pub fn storage_dir(app_id: &str) -> Option<PathBuf> {
18-
use egui::os::OperatingSystem as OS;
1916
use std::env::var_os;
17+
18+
use egui::os::OperatingSystem as OS;
2019
match OS::from_target_os() {
2120
OS::Nix => var_os("XDG_DATA_HOME")
2221
.map(PathBuf::from)
@@ -46,8 +45,7 @@ pub fn storage_dir(app_id: &str) -> Option<PathBuf> {
4645
fn roaming_appdata() -> Option<PathBuf> {
4746
use std::ffi::OsString;
4847
use std::os::windows::ffi::OsStringExt as _;
49-
use std::ptr;
50-
use std::slice;
48+
use std::{ptr, slice};
5149

5250
use windows_sys::Win32::Foundation::S_OK;
5351
use windows_sys::Win32::System::Com::CoTaskMemFree;

crates/eframe/src/native/glow_integration.rs

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,33 @@
77
88
#![allow(clippy::undocumented_unsafe_blocks)]
99

10-
use std::{cell::RefCell, num::NonZeroU32, rc::Rc, sync::Arc, time::Instant};
11-
12-
use egui_winit::ActionRequested;
13-
use glutin::{
14-
config::GlConfig as _,
15-
context::NotCurrentGlContext as _,
16-
display::GetGlDisplay as _,
17-
prelude::{GlDisplay as _, PossiblyCurrentGlContext as _},
18-
surface::GlSurface as _,
19-
};
20-
use raw_window_handle::HasWindowHandle as _;
21-
use winit::{
22-
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
23-
window::{Window, WindowId},
24-
};
10+
use std::cell::RefCell;
11+
use std::num::NonZeroU32;
12+
use std::rc::Rc;
13+
use std::sync::Arc;
14+
use std::time::Instant;
2515

2616
use ahash::HashMap;
2717
use egui::{
2818
DeferredViewportUiCallback, ImmediateViewport, OrderedViewportIdMap, ViewportBuilder,
2919
ViewportClass, ViewportId, ViewportIdPair, ViewportInfo, ViewportOutput,
3020
};
21+
use egui_winit::ActionRequested;
3122
#[cfg(feature = "accesskit")]
3223
use egui_winit::accesskit_winit;
24+
use glutin::config::GlConfig as _;
25+
use glutin::context::NotCurrentGlContext as _;
26+
use glutin::display::GetGlDisplay as _;
27+
use glutin::prelude::{GlDisplay as _, PossiblyCurrentGlContext as _};
28+
use glutin::surface::GlSurface as _;
29+
use raw_window_handle::HasWindowHandle as _;
30+
use winit::event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy};
31+
use winit::window::{Window, WindowId};
3332

34-
use crate::{
35-
App, AppCreator, CreationContext, NativeOptions, Result, Storage,
36-
native::epi_integration::EpiIntegration,
37-
};
38-
39-
use super::{
40-
epi_integration, event_loop_context,
41-
winit_integration::{EventResult, UserEvent, WinitApp, create_egui_context},
42-
};
33+
use super::winit_integration::{EventResult, UserEvent, WinitApp, create_egui_context};
34+
use super::{epi_integration, event_loop_context};
35+
use crate::native::epi_integration::EpiIntegration;
36+
use crate::{App, AppCreator, CreationContext, NativeOptions, Result, Storage};
4337

4438
// ----------------------------------------------------------------------------
4539
// Types:

crates/eframe/src/native/run.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
use std::time::Instant;
22

3-
use winit::{
4-
application::ApplicationHandler,
5-
event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
6-
window::WindowId,
7-
};
8-
93
use ahash::HashMap;
4+
use winit::application::ApplicationHandler;
5+
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
6+
use winit::window::WindowId;
107

118
use super::winit_integration::{UserEvent, WinitApp};
12-
use crate::{
13-
Result, epi,
14-
native::{event_loop_context, winit_integration::EventResult},
15-
};
9+
use crate::native::event_loop_context;
10+
use crate::native::winit_integration::EventResult;
11+
use crate::{Result, epi};
1612

1713
// ----------------------------------------------------------------------------
1814
fn create_event_loop(native_options: &mut epi::NativeOptions) -> Result<EventLoop<UserEvent>> {

0 commit comments

Comments
 (0)