Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Eliminate build warnings from the main project#13386

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
logiclrd wants to merge19 commits intorustdesk:master
base:master
Choose a base branch
Loading
fromlogiclrd:build-warnings

Conversation

@logiclrd
Copy link
Contributor

This PR makes minor adjustments so thatrustdesk builds without warnings.

Before:

C:\code\rustdesk>cargo build 2>&1 | find "warning"warning: unused imports: `MOUSE_BUTTON_LEFT`, `MOUSE_TYPE_DOWN`, `MOUSE_TYPE_UP`, and `MOUSE_TYPE_WHEEL`warning: use of deprecated function `hbb_common::base64::encode`: Use Engine::encodewarning: variable does not need to be mutablewarning: fields `x` and `y` are never readwarning: constant `MOUSE_MOVE_PROTECTION_TIMEOUT` is never usedwarning: constant `MOUSE_ACTIVE_DISTANCE` is never usedwarning: function `get_last_input_cursor_pos` is never usedwarning: methods `read_empty_dirs`, `set_confirm_override_file`, and `rename_file` are never usedwarning: function `query_online_states` is never usedwarning: function `create_online_stream` is never usedwarning: function `query_online_states_` is never usedwarning: methods `http_request` and `get_http_status` are never usedwarning: methods `into_string` and `save` are never usedwarning: function `get_chatid_telegram` is never usedwarning: static `CONTROLLING_SESSION_COUNT` is never usedwarning: function `update_controlling_session_count` is never usedwarning: function `http_request` is never usedwarning: function `get_async_http_status` is never usedwarning: function `has_valid_bot` is never usedwarning: function `verify_bot` is never usedwarning: enum `HbbHttpResponse` is never usedwarning: struct `DownloadData` is never constructedwarning: struct `Downloader` is never constructedwarning: function `download_file` is never usedwarning: function `do_download` is never usedwarning: function `get_download_data` is never usedwarning: function `cancel` is never usedwarning: function `remove` is never usedwarning: `rustdesk` (lib) generated 28 warnings (run `cargo fix --lib -p rustdesk` to apply 2 suggestions)warning: unused import: `librustdesk::*`warning: `rustdesk` (bin "service") generated 1 warning (run `cargo fix --bin "service"` to apply 1 suggestion)C:\code\rustdesk>

After:

C:\code\rustdesk>cargo clean -p rustdesk     Removed 401 files, 6.6GiB totalC:\code\rustdesk>cargo build   Compiling rustdesk v1.4.3 (C:\code\rustdesk)    Finished `dev` profile [unoptimized + debuginfo] target(s) in 40.47sC:\code\rustdesk>

In this PR, each type of warning is addressed in a separate commit.

@rustdesk
Copy link
Owner

fix ci please.

@logiclrd
Copy link
ContributorAuthor

Huh. There's some code thatdoes require it to be mutable, but that code is only enabled for themacos target.

…d on whether the code that requires it to be mutable is enabled.
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR addresses Rust compiler warnings by adding#[allow(...)] attributes to suppress false-positive dead code warnings for code that is actually used via FFI or in conditional compilation contexts. It also handles a deprecated base64 API warning and fixes a mutability issue with an event loop variable.

  • Suppresses dead code warnings for FFI-accessible functions and types
  • Handles deprecatedbase64::encode API with allow attribute
  • Corrects event loop mutability for non-macOS builds

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
src/updater.rsAdded#[allow(dead_code)] for session count tracking used via conditional compilation
src/ui_session_interface.rsAdded#[allow(unused_imports)] for conditionally used imports
src/ui_interface.rsAdded module-level#[allow(dead_code)] for FFI-accessible interface
src/ui.rsAdded#[allow(dead_code)] for HTTP request methods called from FFI
src/tray.rsFixed event loop mutability by making it non-mutable on non-macOS platforms
src/service.rsRemoved unused imports
src/server/input_service.rsAdded#[allow(unused)] for conditionally compiled code
src/hbbs_http/sync.rsScoped#[allow(deprecated)] for base64 API usage
src/hbbs_http/downloader.rsAdded module-level#[allow(dead_code)] for FFI-accessible downloader
src/hbbs_http.rsAdded#[allow(dead_code)] for HTTP response enum
src/client/file_trait.rsAdded#[allow(dead_code)] for trait used in flutter_ffi
src/client.rsAdded#[allow(dead_code)] for peer_online module
src/auth_2fa.rsAdded#[allow(dead_code)] for 2FA implementation and methods

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

Comment on lines 187 to 190
{
#![allow(deprecated)]
hash = hbb_common::base64::encode(&res[..]);
}
Copy link

CopilotAINov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The#![allow(deprecated)] inner attribute applies to the entire block scope. Consider using an outer attribute#[allow(deprecated)] on the statement instead for more precise scoping. Change to:#[allow(deprecated)] hash = hbb_common::base64::encode(&res[..]); and remove the block braces.

Suggested change
{
#![allow(deprecated)]
hash = hbb_common::base64::encode(&res[..]);
}
#[allow(deprecated)]
hash = hbb_common::base64::encode(&res[..]);

Copilot uses AI. Check for mistakes.
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is really 6 of one, half a dozen of the other 😛 I deliberately made a single-statement block to set it out, because I feel like allowing deprecated code isusually something that should be avoided, and where it's not avoided, it should be noticed. The intent needs to be clear. Would you prefer that this be written as an outer attribute instead, though? The style preference for the code-base carries the most weight here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

should change to encode64 in src/common.rs

Copy link
Owner

@rustdeskrustdeskNov 2, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

can ask chatgpt cl (or cursor ci, cc, codex etc) to do this, it will be quite quick.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, nice, centralization of the override. 🙂

@rustdesk
Copy link
Owner

Could you fix the CI?

logiclrd reacted with thumbs up emoji

@logiclrd
Copy link
ContributorAuthor

There are some OS X-specific warnings that I have no idea what to do with:

Warning: warning: rustdesk@1.4.3: src/platform/macos.mm:96:18: warning: 'AuthorizationExecuteWithPrivileges' is deprecated: first deprecated in macOS 10.7 [-Wdeprecated-declarations]warning: rustdesk@1.4.3:         status = AuthorizationExecuteWithPrivileges(authRef, process, kAuthorizationFlagDefaults, args, &pipe);warning: rustdesk@1.4.3:                  ^warning: rustdesk@1.4.3: /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:427:10: note: 'AuthorizationExecuteWithPrivileges' has been explicitly marked deprecated herewarning: rustdesk@1.4.3: OSStatus AuthorizationExecuteWithPrivileges(AuthorizationRef authorization,warning: rustdesk@1.4.3:          ^Warning: warning: rustdesk@1.4.3: src/platform/macos.mm:134:30: warning: 'CGDisplayModeCopyPixelEncoding' is deprecated: first deprecated in macOS 10.11 - No longer supported [-Wdeprecated-declarations]warning: rustdesk@1.4.3:         CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding(mode);warning: rustdesk@1.4.3:                                     ^warning: rustdesk@1.4.3: /Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:177:34: note: 'CGDisplayModeCopyPixelEncoding' has been explicitly marked deprecated herewarning: rustdesk@1.4.3: CG_EXTERN CFStringRef __nullable CGDisplayModeCopyPixelEncoding(warning: rustdesk@1.4.3:                                  ^

@logiclrd
Copy link
ContributorAuthor

Also, my initial changes and observation of no more build warnings was on a Windows machine. I'm at my Linux machine now, and see a number of warnings that don't appear on Windows presumably because of conditional compilation; those bits are entirely excluded on Windows. Checking into these...

- Marked MouseButton and ScrollDirection in server/uinput.rs as allow(unused).- Removed the resolution field from RdpInputMouse, as nothing actually ever reads from it. (The constructor still takes it, as it derives instance data from its value.)- Updated server/display_service.rs to only generate the is_capturer_mag_supported function and the IS_CAPTURER_MAGNIFIER_SUPPORTED lazy static on the "windows" configuration.- Updated server/connection.rs to not import crate::clipboard_file::* for target_os "linux".- Updated the conditional attribute of enable_file_transfer in server/connection.rs to match the condition applied to its use (target_os "windows" | feature "unix-file-copy-paste").- Updated align_to_32 in server/audio_service.rs to not assign a value to buf that it then immediately overwrites.- Removed unnecessary assignment to local "conn" in a lambda within sync_and_watch_config_dir in server.rs.- Moved the is_opensuse() function in platform/linux.rs into the comment block wrapping function elevate, which is its only consumer.- Updated platform/linux.rs to use whoami::fallible::hostname instead of the deprecated whoami::hostname.- Updated platform/linux.rs to mark the AwakeHandle inside WakeLock with [allow(unused)], since nothing explicitly reads it; its purpose is simply its presence.- Updated flutter_ffi.rs to conditionally import PathBuf for the platforms that have code explicitly using it, and to not import time::Duration at all. I think it is unnecessary??
…uggested but was wrong anyway, with increasing the scope of the import of crate::clipboard_file::* to include feature "unix-file-copy-paste".
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/server/uinput.rs:773

  • The module name 'mouce' appears to be a typo. It should be 'mouse' to match the actual functionality (mouse input handling). The comment on line 772 references 'https://github.com/emrebicer/mouce' which suggests this might be intentionally named after that library, but this is still confusing and should be clarified or corrected.
mod mouce {

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@rustdesk
Copy link
Owner

rustdesk commentedNov 7, 2025
edited
Loading

There are some OS X-specific warnings that I have no idea what to do with:

These are useful warnings, should not be removed.

logiclrd reacted with thumbs up emoji

…e::clipboard_file::* in connection.rs. This might break the OS X build, in which case I will undo this change.
… fallible::hostname() in platform/linux.rs, because the value the functor was yielding was the default anyway.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@rustdeskrustdeskrustdesk requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@logiclrd@rustdesk

[8]ページ先頭

©2009-2025 Movatter.jp