Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.

Commit c37db8d

Browse files
committed
Fix msg_send macro unknown return type errors
1 parent a8a6bcb commit c37db8d

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

Diff for: macos/src/appkit.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl NSControl {
156156

157157
pub fn set_text(&self, text: &str) {
158158
unsafe {
159-
msg_send![self.ptr, setStringValue:NSString::from(text).ptr()];
159+
msg_send![self.ptr, setStringValue:NSString::from(text).ptr()]
160160
}
161161
}
162162

@@ -167,7 +167,7 @@ impl NSControl {
167167
let font: Id = msg_send![class!(NSFont), fontWithName:name
168168
size:size];
169169
if font != nil {
170-
msg_send![self.ptr, setFont:font];
170+
msg_send![self.ptr, setFont:font]
171171
}
172172
}
173173
}
@@ -217,7 +217,7 @@ impl NSLayoutConstraint {
217217
}
218218

219219
pub fn set_constant(&self, constant: CGFloat) {
220-
unsafe { msg_send![self.ptr, setConstant:constant]; }
220+
unsafe { msg_send![self.ptr, setConstant:constant] }
221221
}
222222

223223
pub fn constant(&self) -> CGFloat {
@@ -299,8 +299,8 @@ impl NSPasteboard {
299299
let data_types = NSMutableArray::new();
300300
data_types.push(NSString::from(NSPASTEBOARD_TYPE_STRING));
301301
unsafe {
302-
msg_send![self.ptr, declareTypes:data_types.ptr() owner:nil];
303-
msg_send![self.ptr, setString:data.ptr() forType:data_type.ptr()];
302+
let () = msg_send![self.ptr, declareTypes:data_types.ptr() owner:nil];
303+
let () = msg_send![self.ptr, setString:data.ptr() forType:data_type.ptr()];
304304
}
305305
}
306306
}
@@ -335,7 +335,7 @@ impl NSView {
335335

336336
pub fn disable_translates_autoresizing_mask_into_constraints(&self) {
337337
unsafe {
338-
msg_send![self.ptr, setTranslatesAutoresizingMaskIntoConstraints:NO];
338+
msg_send![self.ptr, setTranslatesAutoresizingMaskIntoConstraints:NO]
339339
}
340340
}
341341

@@ -373,7 +373,7 @@ impl NSView {
373373

374374
pub fn set_hidden(&self, hidden: bool) {
375375
let value = if hidden { YES } else { NO };
376-
unsafe { msg_send![self.ptr, setHidden:value]; }
376+
unsafe { msg_send![self.ptr, setHidden:value] }
377377
}
378378

379379
pub fn hidden(&self) -> bool {
@@ -411,15 +411,15 @@ impl NSWindow {
411411
}
412412

413413
pub fn close(&mut self) {
414-
unsafe { msg_send![self.ptr, close]; }
414+
let () = unsafe { msg_send![self.ptr, close] };
415415
self.ptr = nil;
416416
}
417417

418418
pub fn release_delegate(&mut self) {
419419
unsafe {
420420
let delegate: Id = msg_send![self.ptr, delegate];
421-
msg_send![delegate, release];
422-
msg_send![self.ptr, setDelegate:nil];
421+
let () = msg_send![delegate, release];
422+
let () = msg_send![self.ptr, setDelegate:nil];
423423
}
424424
}
425425

Diff for: macos/src/foundation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl NSAppleEventManager {
7171
msg_send![self.ptr, setEventHandler:handler.ptr()
7272
andSelector:sel!(handleGetURLEvent:withReplyEvent:)
7373
forEventClass:INTERNET_EVENT_CLASS
74-
andEventID:GET_URL_EVENT_ID];
74+
andEventID:GET_URL_EVENT_ID]
7575
}
7676
}
7777
}

Diff for: macos/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ macro_rules! impl_objc_class {
7878
}
7979

8080
fn release(&mut self) {
81-
unsafe { msg_send![self.ptr(), release]; }
81+
let () = unsafe { msg_send![self.ptr(), release] };
8282
self.ptr = 0 as Id;
8383
}
8484
}

Diff for: macos/src/webkit.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,23 @@ impl WKPreferences {
9898

9999
pub fn set_javascript_enabled(&self, enabled: bool) {
100100
let value = if enabled { YES } else { NO };
101-
unsafe { msg_send![self.ptr, setJavaScriptEnabled:value]; }
101+
unsafe { msg_send![self.ptr, setJavaScriptEnabled:value] }
102102
}
103103

104104
pub fn set_plugins_enabled(&self, enabled: bool) {
105105
let value = if enabled { YES } else { NO };
106-
unsafe { msg_send![self.ptr, setPlugInsEnabled:value]; }
106+
unsafe { msg_send![self.ptr, setPlugInsEnabled:value] }
107107
}
108108
}
109109

110110
impl WKUserContentController {
111111

112112
pub fn add_user_content_filter(&self, filter: _WKUserContentFilter) {
113-
unsafe { msg_send![self.ptr, _addUserContentFilter:filter.ptr()]; }
113+
unsafe { msg_send![self.ptr, _addUserContentFilter:filter.ptr()] }
114114
}
115115

116116
pub fn add_user_style_sheet(&self, stylesheet: _WKUserStyleSheet) {
117-
unsafe { msg_send![self.ptr, _addUserStyleSheet:stylesheet.ptr()]; }
117+
unsafe { msg_send![self.ptr, _addUserStyleSheet:stylesheet.ptr()] }
118118
}
119119

120120
pub fn can_add_user_style_sheet(&self) -> bool {
@@ -138,15 +138,15 @@ impl WKWebView {
138138
}
139139

140140
pub fn load_request(&self, request: NSURLRequest) {
141-
unsafe { msg_send![self.ptr, loadRequest:request.ptr()]; }
141+
unsafe { msg_send![self.ptr, loadRequest:request.ptr()] }
142142
}
143143

144144
pub fn set_history_delegate<T: ObjCClass>(&self, delegate: T) {
145-
unsafe { msg_send![self.ptr, _setHistoryDelegate:delegate.ptr()]; }
145+
unsafe { msg_send![self.ptr, _setHistoryDelegate:delegate.ptr()] }
146146
}
147147

148148
pub fn set_navigation_delegate<T: ObjCClass>(&self, delegate: T) {
149-
unsafe { msg_send![self.ptr, setNavigationDelegate:delegate.ptr()]; }
149+
unsafe { msg_send![self.ptr, setNavigationDelegate:delegate.ptr()] }
150150
}
151151

152152
pub fn configuration(&self) -> WKWebViewConfiguration {
@@ -166,20 +166,20 @@ impl WKWebView {
166166
}
167167

168168
pub fn go_back(&self) {
169-
unsafe { msg_send![self.ptr, goBack]; }
169+
unsafe { msg_send![self.ptr, goBack] }
170170
}
171171

172172
pub fn go_forward(&self) {
173-
unsafe { msg_send![self.ptr, goForward]; }
173+
unsafe { msg_send![self.ptr, goForward] }
174174
}
175175

176176
pub fn reload(&self) {
177-
unsafe { msg_send![self.ptr, reload:nil]; }
177+
unsafe { msg_send![self.ptr, reload:nil] }
178178
}
179179

180180
pub fn reload_without_content_blockers(&self) {
181181
if self.can_reload_without_content_blockers() {
182-
unsafe { msg_send![self.ptr, _reloadWithoutContentBlockers]; }
182+
unsafe { msg_send![self.ptr, _reloadWithoutContentBlockers] }
183183
}
184184
}
185185

@@ -192,7 +192,7 @@ impl WKWebView {
192192
}
193193

194194
pub fn stop_loading(&self) {
195-
unsafe { msg_send![self.ptr, stopLoading]; }
195+
unsafe { msg_send![self.ptr, stopLoading] }
196196
}
197197

198198
pub fn has_only_secure_content(&self) -> bool {
@@ -203,7 +203,7 @@ impl WKWebView {
203203
pub fn load_html_string(&self, contents: &str, base_url: &str) {
204204
unsafe {
205205
msg_send![self.ptr, loadHTMLString:NSString::from(contents)
206-
baseURL:NSURL::from(NSString::from(base_url))];
206+
baseURL:NSURL::from(NSString::from(base_url))]
207207
}
208208
}
209209

@@ -222,7 +222,7 @@ impl WKWebView {
222222

223223
pub fn set_custom_user_agent(&self, user_agent: &str) {
224224
unsafe {
225-
msg_send![self.ptr, setCustomUserAgent:NSString::from(user_agent)];
225+
msg_send![self.ptr, setCustomUserAgent:NSString::from(user_agent)]
226226
}
227227
}
228228

@@ -233,7 +233,7 @@ impl WKWebView {
233233
pub fn evaluate_javascript(&self, script: &str) {
234234
unsafe {
235235
msg_send![self.ptr, evaluateJavaScript:NSString::from(script)
236-
completionHandler:nil];
236+
completionHandler:nil]
237237
}
238238
}
239239

@@ -246,31 +246,31 @@ impl WKWebView {
246246
unsafe {
247247
msg_send![self.ptr, _findString:NSString::from(query)
248248
options:options
249-
maxCount:100 as NSUInteger];
249+
maxCount:100 as NSUInteger]
250250
}
251251
}
252252

253253
pub fn hide_find_results(&self) {
254-
unsafe { msg_send![self.ptr, _hideFindUI]; }
254+
unsafe { msg_send![self.ptr, _hideFindUI] }
255255
}
256256

257257
pub fn remove_from_superview(&self) {
258-
unsafe { msg_send![self.ptr, removeFromSuperview]; }
258+
unsafe { msg_send![self.ptr, removeFromSuperview] }
259259
}
260260

261261
pub fn release_delegates(&self) {
262262
unsafe {
263263
let nav_delegate: Id = msg_send![self.ptr, navigationDelegate];
264-
msg_send![nav_delegate, release];
264+
let () = msg_send![nav_delegate, release];
265265
let history_delegate: Id = msg_send![self.ptr, _historyDelegate];
266-
msg_send![history_delegate, release];
267-
msg_send![self.ptr, setNavigationDelegate:nil];
268-
msg_send![self.ptr, _setHistoryDelegate:nil];
266+
let () = msg_send![history_delegate, release];
267+
let () = msg_send![self.ptr, setNavigationDelegate:nil];
268+
let () = msg_send![self.ptr, _setHistoryDelegate:nil];
269269
}
270270
}
271271

272272
pub fn close(&self) {
273-
unsafe { msg_send![self.ptr, _close]; }
273+
unsafe { msg_send![self.ptr, _close] }
274274
}
275275
}
276276

@@ -341,7 +341,7 @@ impl _WKUserContentExtensionStore {
341341
unsafe {
342342
msg_send![self.ptr, compileContentExtensionForIdentifier:id_str
343343
encodedContentExtension:ex_str
344-
completionHandler:block.deref()];
344+
completionHandler:block.deref()]
345345
}
346346
}
347347

@@ -351,7 +351,7 @@ impl _WKUserContentExtensionStore {
351351
let id_str = NSString::from(identifier);
352352
unsafe {
353353
msg_send![self.ptr, lookupContentExtensionForIdentifier:id_str
354-
completionHandler:block.deref()];
354+
completionHandler:block.deref()]
355355
}
356356
}
357357
}

Diff for: webkitten-cocoa/src/runtime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ impl CommandBarView {
7676

7777
pub fn new() -> Self {
7878
let ptr = unsafe {
79-
msg_send![view, setTranslatesAutoresizingMaskIntoConstraints:NO];
8079
let view: Id = msg_send![class!(CommandBarView), new];
80+
let () = msg_send![view, setTranslatesAutoresizingMaskIntoConstraints:NO];
8181
view
8282
};
8383
CommandBarView { ptr: ptr }

0 commit comments

Comments
 (0)