Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(macos): suppress unused_variables warning reported only in release build #790

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/suppress_unused_vars_warning_in_release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": "patch"
---

Suppress `unused_variables` warning reported only in release build.
14 changes: 8 additions & 6 deletions src/webview/wkwebview/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,20 @@ pub extern "C" fn download_did_finish(this: &Object, _: Sel, download: id) {
}
}

pub extern "C" fn download_did_fail(this: &Object, _: Sel, download: id, error: id, _: id) {
pub extern "C" fn download_did_fail(this: &Object, _: Sel, download: id, _error: id, _: id) {
unsafe {
let description: id = msg_send![error, localizedDescription];
let description = NSString(description).to_str().to_string();
#[cfg(debug_assertions)]
{
let description: id = msg_send![_error, localizedDescription];
let description = NSString(description).to_str().to_string();
eprintln!("Download failed with error: {}", description);
}

let original_request: id = msg_send![download, originalRequest];
let url: id = msg_send![original_request, URL];
let url: id = msg_send![url, absoluteString];
let url = NSString(url).to_str().to_string();

#[cfg(debug_assertions)]
eprintln!("Download failed with error: {}", description);

let function = this.get_ivar::<*mut c_void>("completed");
if !function.is_null() {
let function = &mut *(*function as *mut Rc<dyn for<'s> Fn(String, Option<PathBuf>, bool)>);
Expand Down