Skip to content

Commit d4cb921

Browse files
authored
Replace #[macro_use] with normal use (#808)
* Replace #[macro_use] with normal use * Fix Windows build * Combine imports * Reorder imports
1 parent a8d062a commit d4cb921

File tree

17 files changed

+37
-36
lines changed

17 files changed

+37
-36
lines changed

druid-shell/src/keyboard.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
//! Keyboard event types and helpers
1616
17-
use super::keycodes::KeyCode;
1817
use std::fmt;
1918

19+
use super::keycodes::KeyCode;
20+
2021
/// A keyboard event, generated on every key press and key release.
2122
#[derive(Debug, Clone, Copy)]
2223
pub struct KeyEvent {

druid-shell/src/lib.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@
2424
pub use kurbo;
2525
pub use piet_common as piet;
2626

27-
#[cfg(target_os = "windows")]
28-
#[macro_use]
29-
extern crate winapi;
30-
31-
#[cfg(all(target_os = "macos", not(feature = "use_gtk")))]
32-
#[macro_use]
33-
extern crate objc;
34-
35-
#[cfg(not(any(feature = "use_gtk", target_os = "linux")))]
36-
#[macro_use]
37-
extern crate lazy_static;
38-
39-
#[cfg(all(target_os = "linux", feature = "x11"))]
40-
#[macro_use]
41-
extern crate lazy_static;
42-
4327
mod application;
4428
mod clipboard;
4529
mod common_util;

druid-shell/src/platform/gtk/clipboard.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
//! Interactions with the system pasteboard on GTK+.
1616
17-
use crate::clipboard::{ClipboardFormat, FormatId};
1817
use gdk::Atom;
1918
use gtk::{TargetEntry, TargetFlags};
2019

20+
use crate::clipboard::{ClipboardFormat, FormatId};
21+
2122
/// The system clipboard.
2223
#[derive(Debug, Clone)]
2324
pub struct Clipboard;

druid-shell/src/platform/gtk/dialog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
1717
use std::ffi::OsString;
1818

19-
use crate::dialog::{FileDialogOptions, FileDialogType};
2019
use gtk::{FileChooserAction, FileChooserExt, NativeDialogExt, ResponseType, Window};
2120

21+
use crate::dialog::{FileDialogOptions, FileDialogType};
2222
use crate::Error;
2323

2424
pub(crate) fn get_file_dialog_path(

druid-shell/src/platform/mac/application.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@
1818

1919
use std::ffi::c_void;
2020

21-
use super::clipboard::Clipboard;
22-
use super::util;
23-
use crate::application::AppHandler;
24-
2521
use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular};
2622
use cocoa::base::{id, nil, YES};
2723
use cocoa::foundation::NSAutoreleasePool;
24+
use lazy_static::lazy_static;
2825
use objc::declare::ClassDecl;
2926
use objc::runtime::{Class, Object, Sel};
27+
use objc::{class, msg_send, sel, sel_impl};
28+
29+
use super::clipboard::Clipboard;
30+
use super::util;
31+
use crate::application::AppHandler;
3032

3133
static APP_HANDLER_IVAR: &str = "druidAppHandler";
3234

druid-shell/src/platform/mac/clipboard.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use cocoa::appkit::NSPasteboardTypeString;
1818
use cocoa::base::{id, nil, BOOL, YES};
1919
use cocoa::foundation::{NSArray, NSInteger, NSUInteger};
20+
use objc::{class, msg_send, sel, sel_impl};
2021

2122
use super::util;
2223
use crate::clipboard::{ClipboardFormat, FormatId};

druid-shell/src/platform/mac/dialog.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use std::ffi::OsString;
2020

2121
use cocoa::base::{id, nil, YES};
2222
use cocoa::foundation::{NSArray, NSInteger};
23+
use objc::{class, msg_send, sel, sel_impl};
2324

2425
use super::util::{from_nsstring, make_nsstring};
2526
use crate::dialog::{FileDialogOptions, FileDialogType};

druid-shell/src/platform/mac/menu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use cocoa::appkit::{NSEventModifierFlags, NSMenu, NSMenuItem};
1818
use cocoa::base::{id, nil, NO};
1919
use cocoa::foundation::NSAutoreleasePool;
20+
use objc::{msg_send, sel, sel_impl};
2021

2122
use super::util::make_nsstring;
2223
use crate::common_util::strip_access_key;

druid-shell/src/platform/mac/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use std::ffi::c_void;
1818

1919
use cocoa::base::{id, nil, BOOL, YES};
2020
use cocoa::foundation::{NSAutoreleasePool, NSString, NSUInteger};
21+
use objc::{class, msg_send, sel, sel_impl};
2122

2223
/// Panic if not on the main thread.assert_main_thread()
2324
///

druid-shell/src/platform/mac/window.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ use cocoa::appkit::{
2929
};
3030
use cocoa::base::{id, nil, BOOL, NO, YES};
3131
use cocoa::foundation::{NSAutoreleasePool, NSPoint, NSRect, NSSize, NSString};
32+
use lazy_static::lazy_static;
3233
use objc::declare::ClassDecl;
3334
use objc::rc::WeakPtr;
3435
use objc::runtime::{Class, Object, Sel};
36+
use objc::{class, msg_send, sel, sel_impl};
3537

3638
use cairo::{Context, QuartzSurface};
3739
use log::{error, info};

0 commit comments

Comments
 (0)