Remove usages of extern crate. (#672)

This commit is contained in:
Bruce Mitchener
2024-05-27 13:40:54 +07:00
committed by GitHub
parent a496791d62
commit 8d2b732db5
38 changed files with 37 additions and 101 deletions
+3 -1
View File
@@ -10,8 +10,10 @@
#![allow(non_upper_case_globals)]
use crate::base::{id, nil, BOOL, NO, SEL};
use bitflags::bitflags;
use block::Block;
use libc;
use objc::{class, msg_send, sel, sel_impl};
use std::os::raw::c_void;
use std::ptr;
@@ -35,7 +37,7 @@ mod macos {
use crate::base::id;
use core_graphics_types::base::CGFloat;
use core_graphics_types::geometry::CGRect;
use objc;
use objc::{self, class, msg_send, sel, sel_impl};
use std::mem;
#[repr(C)]
-9
View File
@@ -9,14 +9,5 @@
#![allow(non_snake_case)]
extern crate block;
#[macro_use]
extern crate bitflags;
extern crate core_foundation;
extern crate core_graphics_types;
extern crate libc;
#[macro_use]
extern crate objc;
pub mod base;
pub mod foundation;
+1 -5
View File
@@ -1,8 +1,3 @@
#[macro_use]
extern crate objc;
extern crate block;
extern crate cocoa_foundation;
#[cfg(test)]
mod foundation {
mod nsstring {
@@ -66,6 +61,7 @@ mod foundation {
mod nsfastenumeration {
use cocoa_foundation::base::{id, nil};
use cocoa_foundation::foundation::{NSFastEnumeration, NSString};
use objc::{msg_send, sel, sel_impl};
use std::slice;
use std::str;
-2
View File
@@ -1,5 +1,3 @@
extern crate cocoa;
use cocoa::base::{id, nil, selector, NO};
use cocoa::appkit::{
+1 -6
View File
@@ -1,9 +1,3 @@
extern crate cocoa;
extern crate core_graphics;
#[macro_use]
extern crate objc;
use cocoa::appkit::{
NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps,
NSApplicationActivationPolicyRegular, NSApplicationPresentationOptions, NSBackingStoreBuffered,
@@ -19,6 +13,7 @@ use core_graphics::display::CGDisplay;
use objc::declare::ClassDecl;
use objc::runtime::{Object, Sel};
use objc::{class, msg_send, sel, sel_impl};
fn main() {
unsafe {
-2
View File
@@ -1,5 +1,3 @@
extern crate cocoa;
use cocoa::appkit::{
NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps,
NSApplicationActivationPolicyRegular, NSBackingStoreBuffered, NSMenu, NSMenuItem,
@@ -1,6 +1,3 @@
extern crate cocoa;
extern crate objc;
use cocoa::base::{nil, selector, NO};
use objc::*;
-2
View File
@@ -1,5 +1,3 @@
extern crate cocoa;
use cocoa::base::{id, nil, selector, NO};
use cocoa::appkit::{
+2
View File
@@ -13,8 +13,10 @@ use crate::base::{id, BOOL, SEL};
use crate::foundation::{
NSInteger, NSPoint, NSRange, NSRect, NSRectEdge, NSSize, NSTimeInterval, NSUInteger,
};
use bitflags::bitflags;
use block::Block;
use libc;
use objc::{class, msg_send, sel, sel_impl};
pub use core_graphics::base::CGFloat;
pub use core_graphics::geometry::CGPoint;
-11
View File
@@ -11,17 +11,6 @@
#![crate_type = "rlib"]
#![allow(non_snake_case)]
extern crate block;
#[macro_use]
extern crate bitflags;
extern crate cocoa_foundation;
extern crate core_foundation;
extern crate core_graphics;
extern crate foreign_types;
extern crate libc;
#[macro_use]
extern crate objc;
#[cfg(target_os = "macos")]
pub mod appkit;
pub mod base;
+3 -4
View File
@@ -12,13 +12,12 @@
///
/// # Example with `NSWindowDelegate`
/// ``` no_run
/// #[macro_use] extern crate cocoa;
/// #[macro_use] extern crate objc;
///
/// use cocoa::appkit::NSWindow;
/// use cocoa::base::{id, nil};
/// use cocoa::delegate;
///
/// use objc::runtime::{Object, Sel};
/// use objc::{msg_send, sel, sel_impl};
///
/// # fn main() {
/// unsafe {
@@ -57,7 +56,7 @@ macro_rules! delegate {
$( ($($sel:ident :)+) => $func:expr),*
}
) => ({
let mut decl = objc::declare::ClassDecl::new($name, class!(NSObject)).unwrap();
let mut decl = objc::declare::ClassDecl::new($name, objc::class!(NSObject)).unwrap();
$(
decl.add_ivar::<$var_type>(stringify!($var));
+3
View File
@@ -9,6 +9,7 @@
#![allow(non_upper_case_globals)]
use bitflags::bitflags;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::base::{CFType, CFTypeRef, TCFType};
use core_foundation::date::CFTimeInterval;
@@ -21,6 +22,7 @@ use core_graphics::context::CGContext;
use core_graphics::geometry::{CGAffineTransform, CGPoint, CGRect, CGSize};
use core_graphics::path::{CGPath, SysCGPathRef};
use foreign_types::ForeignType;
use objc::{class, msg_send, sel, sel_impl};
use std::ops::Mul;
use std::ptr;
@@ -1358,6 +1360,7 @@ pub mod transaction {
use block::{Block, ConcreteBlock, IntoConcreteBlock, RcBlock};
use core_foundation::date::CFTimeInterval;
use core_foundation::string::CFString;
use objc::{class, msg_send, sel, sel_impl};
use crate::base::{id, BOOL, YES};
-2
View File
@@ -97,8 +97,6 @@ impl AsRawFd for CFFileDescriptor {
#[cfg(test)]
mod test {
extern crate libc;
use super::*;
use crate::runloop::CFRunLoop;
use core_foundation_sys::base::CFOptionFlags;
+1 -7
View File
@@ -15,12 +15,6 @@
//! It also provides a framework for other crates to use when wrapping
//! other frameworks that use the CoreFoundation framework.
extern crate core_foundation_sys;
extern crate libc;
#[cfg(feature = "with-chrono")]
extern crate chrono;
use crate::base::TCFType;
pub unsafe trait ConcreteCFType: TCFType {}
@@ -32,7 +26,7 @@ pub unsafe trait ConcreteCFType: TCFType {}
/// provided using the [`impl_TCFType`] macro.
///
/// ```
/// #[macro_use] extern crate core_foundation;
/// use core_foundation::{declare_TCFType, impl_TCFType};
/// // Make sure that the `TCFType` trait is in scope.
/// use core_foundation::base::{CFTypeID, TCFType};
///
+1 -4
View File
@@ -9,16 +9,13 @@
//! Core Foundation UUID objects.
#[cfg(feature = "with-uuid")]
extern crate uuid;
use core_foundation_sys::base::kCFAllocatorDefault;
pub use core_foundation_sys::uuid::*;
use crate::base::TCFType;
#[cfg(feature = "with-uuid")]
use self::uuid::Uuid;
use uuid::Uuid;
declare_TCFType! {
/// A UUID.
@@ -1,7 +1,5 @@
#[macro_use]
extern crate core_foundation;
use core_foundation::base::{CFComparisonResult, TCFType};
use core_foundation::{declare_TCFType, impl_CFComparison, impl_CFTypeDescription, impl_TCFType};
use std::os::raw::c_void;
// sys equivalent stuff that must be declared
-3
View File
@@ -7,8 +7,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate core_foundation;
extern crate libc;
pub mod base;
pub mod geometry;
+1
View File
@@ -11,6 +11,7 @@ use super::sys::CGColorRef;
use crate::base::CGFloat;
use core_foundation::base::CFTypeID;
use core_foundation::base::TCFType;
use core_foundation::{declare_TCFType, impl_TCFType};
pub use super::sys::CGColorRef as SysCGColorRef;
+1 -1
View File
@@ -9,7 +9,7 @@
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use core_foundation::string::CFStringRef;
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
foreign_type! {
#[doc(hidden)]
+1 -1
View File
@@ -20,7 +20,7 @@ use std::os::raw::c_void;
use crate::geometry::{CGAffineTransform, CGRect};
use crate::image::CGImage;
use foreign_types::{ForeignType, ForeignTypeRef};
use foreign_types::{foreign_type, ForeignType, ForeignTypeRef};
use std::cmp;
use std::ptr;
use std::slice;
+1 -1
View File
@@ -16,7 +16,7 @@ use std::os::raw::c_void;
use std::ptr;
use std::sync::Arc;
use foreign_types::{ForeignType, ForeignTypeRef};
use foreign_types::{foreign_type, ForeignType, ForeignTypeRef};
pub type CGDataProviderGetBytesCallback =
Option<unsafe extern "C" fn(*mut c_void, *mut c_void, size_t) -> size_t>;
+1 -1
View File
@@ -19,7 +19,7 @@ pub use crate::geometry::{CGPoint, CGRect, CGSize};
use crate::image::CGImage;
use core_foundation::base::{CFRetain, TCFType};
use core_foundation::string::{CFString, CFStringRef};
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
pub type CGDirectDisplayID = u32;
pub type CGWindowID = u32;
+3 -2
View File
@@ -1,11 +1,13 @@
#![allow(non_upper_case_globals)]
use crate::event_source::CGEventSource;
use crate::geometry::CGPoint;
use bitflags::bitflags;
use core_foundation::{
base::{CFRelease, CFRetain, CFTypeID, TCFType},
mach_port::{CFMachPort, CFMachPortRef},
};
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
use libc::c_void;
use std::mem::ManuallyDrop;
@@ -441,7 +443,6 @@ unsafe extern "C" fn cg_event_tap_callback_internal(
}
/// ```no_run
///extern crate core_foundation;
///use core_foundation::runloop::{kCFRunLoopCommonModes, CFRunLoop};
///use core_graphics::event::{CGEventTap, CGEventTapLocation, CGEventTapPlacement, CGEventTapOptions, CGEventType};
///let current = CFRunLoop::get_current();
+1 -1
View File
@@ -1,5 +1,5 @@
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
/// Possible source states of an event source.
#[repr(C)]
+1 -1
View File
@@ -17,7 +17,7 @@ use core_foundation::number::CFNumber;
use core_foundation::string::{CFString, CFStringRef};
use std::ptr::NonNull;
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
use libc::{c_int, size_t};
+2 -1
View File
@@ -13,9 +13,10 @@ use crate::base::CGFloat;
use crate::color::CGColor;
use crate::color_space::CGColorSpace;
use bitflags::bitflags;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::base::{CFRelease, CFRetain, TCFType};
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
use libc::size_t;
+1 -1
View File
@@ -6,7 +6,7 @@ use crate::data_provider::{CGDataProvider, CGDataProviderRef};
use crate::geometry::CGRect;
use core_foundation::base::{CFRetain, CFTypeID};
use core_foundation::data::CFData;
use foreign_types::{ForeignType, ForeignTypeRef};
use foreign_types::{foreign_type, ForeignType, ForeignTypeRef};
use libc::size_t;
#[repr(C)]
-13
View File
@@ -7,19 +7,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate libc;
#[macro_use]
extern crate core_foundation;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate foreign_types;
extern crate core_graphics_types;
#[cfg(target_os = "macos")]
pub mod access;
pub mod base;
+1 -1
View File
@@ -11,7 +11,7 @@ pub use crate::sys::CGPathRef as SysCGPathRef;
use crate::geometry::{CGAffineTransform, CGPoint, CGRect};
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use foreign_types::ForeignType;
use foreign_types::{foreign_type, ForeignType};
use libc::c_void;
use std::fmt::{self, Debug, Formatter};
use std::marker::PhantomData;
+1
View File
@@ -23,6 +23,7 @@ use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use core_foundation::number::CFNumber;
use core_foundation::string::{CFString, CFStringRef, UniChar};
use core_foundation::url::{CFURLRef, CFURL};
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::base::CGFloat;
use core_graphics::context::CGContext;
use core_graphics::font::{CGFont, CGGlyph};
+1
View File
@@ -19,6 +19,7 @@ use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use core_foundation::number::CFNumber;
use core_foundation::set::CFSet;
use core_foundation::string::{CFString, CFStringRef};
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use std::os::raw::c_void;
+1
View File
@@ -16,6 +16,7 @@ use core_foundation::number::{CFNumber, CFNumberRef};
use core_foundation::set::CFSetRef;
use core_foundation::string::{CFString, CFStringRef};
use core_foundation::url::{CFURLRef, CFURL};
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::base::CGFloat;
use std::os::raw::c_void;
+1
View File
@@ -10,6 +10,7 @@
use crate::line::CTLine;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::base::{CFRange, CFTypeID, TCFType};
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::context::{CGContext, CGContextRef};
use core_graphics::geometry::CGPoint;
use core_graphics::path::{CGPath, SysCGPathRef};
+1
View File
@@ -11,6 +11,7 @@ use super::frame::{CTFrame, CTFrameRef};
use core_foundation::attributed_string::CFAttributedStringRef;
use core_foundation::base::{CFRange, CFTypeID, TCFType};
use core_foundation::dictionary::CFDictionaryRef;
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::geometry::CGSize;
use core_graphics::path::{CGPath, CGPathRef};
use foreign_types::{ForeignType, ForeignTypeRef};
-7
View File
@@ -16,13 +16,6 @@ Many of these functions will add objects to the autorelease pool.
If you don't have one this will cause leaks.
*/
extern crate foreign_types;
extern crate libc;
#[macro_use]
extern crate core_foundation;
extern crate core_graphics;
pub mod font;
pub mod font_collection;
pub mod font_descriptor;
+1
View File
@@ -11,6 +11,7 @@ use crate::run::CTRun;
use core_foundation::array::{CFArray, CFArrayRef};
use core_foundation::attributed_string::CFAttributedStringRef;
use core_foundation::base::{CFIndex, CFRange, CFTypeID, TCFType};
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::base::CGFloat;
use core_graphics::context::CGContext;
use core_graphics::geometry::{CGPoint, CGRect};
+1
View File
@@ -10,6 +10,7 @@
use core_foundation::base::{CFIndex, CFRange, CFType, CFTypeID, TCFType};
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use core_foundation::string::CFString;
use core_foundation::{declare_TCFType, impl_CFTypeDescription, impl_TCFType};
use core_graphics::base::CGFloat;
use core_graphics::font::CGGlyph;
use core_graphics::geometry::CGPoint;
-6
View File
@@ -10,12 +10,6 @@
#![crate_name = "io_surface"]
#![crate_type = "rlib"]
extern crate cgl;
extern crate core_foundation;
extern crate core_foundation_sys;
extern crate leaky_cow;
extern crate libc;
// Rust bindings to the IOSurface framework on macOS.
use cgl::{kCGLNoError, CGLErrorString, CGLGetCurrentContext, CGLTexImageIOSurface2D, GLenum};