Skip to content

Commit bf2881e

Browse files
committed
refactor: use kCGErrorSuccess
1 parent 03ea008 commit bf2881e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core-graphics/src/display.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub use crate::geometry::{CGPoint, CGRect, CGSize};
2020
use crate::image::CGImage;
2121
use core_foundation::base::{CFRetain, TCFType};
2222
use core_foundation::string::{CFString, CFStringRef};
23+
use core_graphics_types::base::kCGErrorSuccess;
2324
use foreign_types::{foreign_type, ForeignType};
2425

2526
pub type CGDirectDisplayID = u32;
@@ -185,7 +186,7 @@ impl CGDisplay {
185186
let result = unsafe {
186187
CGGetDisplaysWithPoint(point, 0, ptr::null_mut(), &mut matching_display_count)
187188
};
188-
if result == 0 {
189+
if result == kCGErrorSuccess {
189190
Ok(matching_display_count)
190191
} else {
191192
Err(result)
@@ -213,7 +214,7 @@ impl CGDisplay {
213214
)
214215
};
215216

216-
if result == 0 {
217+
if result == kCGErrorSuccess {
217218
Ok((displays, matching_display_count))
218219
} else {
219220
Err(result)
@@ -227,7 +228,7 @@ impl CGDisplay {
227228
let mut matching_display_count: u32 = 0;
228229
let result =
229230
unsafe { CGGetDisplaysWithRect(rect, 0, ptr::null_mut(), &mut matching_display_count) };
230-
if result == 0 {
231+
if result == kCGErrorSuccess {
231232
Ok(matching_display_count)
232233
} else {
233234
Err(result)
@@ -254,7 +255,7 @@ impl CGDisplay {
254255
)
255256
};
256257

257-
if result == 0 {
258+
if result == kCGErrorSuccess {
258259
Ok((displays, matching_display_count))
259260
} else {
260261
Err(result)

0 commit comments

Comments
 (0)