Self-compiled Binary - rust cargo Warning #1397

Closed
opened 2025-10-09 17:13:56 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @Obivatelj on GitHub.

Subject of the issue

Self-compiled Binary Warning

Deployment environment

rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /root/.rustup

installed toolchains

stable-x86_64-unknown-linux-gnu (default)
nightly-2021-04-14-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu

active toolchain

nightly-2021-04-14-x86_64-unknown-linux-gnu (overridden by '/tmp/vaultwarden/rust-toolchain')
rustc 1.53.0-nightly (132b4e5d1 2021-04-13)

Your environment (Generated via diagnostics page)

  • Bitwarden_rs version: v1.20.0-5c5700ca
  • Web-vault version: v2.19.0d
  • Running within Docker: false
  • Uses a reverse proxy: true
  • IP Header check: true (X-Real-IP)
  • Internet access: false
  • Internet access via a proxy: false
  • DNS Check: true
  • Time Check: true
  • Domain Configuration Check: true
  • HTTPS Check: true
  • Database type: MySQL
  • Database version: 8.0.21
  • Clients used:
  • Reverse proxy and version: nginx + haproxy
  • Other relevant information:

Config (Generated via diagnostics page)

{
  "_duo_akey": null,
  "_enable_duo": false,
  "_enable_email_2fa": true,
  "_enable_smtp": true,
  "_enable_yubico": true,
  "_ip_header_enabled": true,
  "admin_token": "***",
  "allowed_iframe_ancestors": "",
  "attachments_folder": "data/attachments",
  "authenticator_disable_time_drift": false,
  "data_folder": "data",
  "database_max_conns": 10,
  "database_url": "*****://**:********************************@*********:****/****",
  "db_connection_retries": 15,
  "disable_2fa_remember": false,
  "disable_admin_token": false,
  "disable_icon_download": true,
  "domain": "*****://*****.*******.***",
  "domain_origin": "*****://*****.*******.***",
  "domain_path": "",
  "domain_set": true,
  "duo_host": null,
  "duo_ikey": null,
  "duo_skey": null,
  "email_attempts_limit": 3,
  "email_expiration_time": 600,
  "email_token_size": 6,
  "enable_db_wal": false,
  "extended_logging": true,
  "helo_name": null,
  "hibp_api_key": null,
  "icon_blacklist_non_global_ips": true,
  "icon_blacklist_regex": null,
  "icon_cache_folder": "data/icon_cache",
  "icon_cache_negttl": 259200,
  "icon_cache_ttl": 0,
  "icon_download_timeout": 10,
  "invitation_org_name": "*****",
  "invitations_allowed": true,
  "ip_header": "X-Real-IP",
  "log_file": "/var/log/bitwarden_rs/bitwarden_rs.log",
  "log_level": "info",
  "log_timestamp_format": "%Y-%m-%d %H:%M:%S.%3f",
  "org_attachment_limit": null,
  "org_creation_users": "*.*****@*******.**,*******-******-*********@**********.**",
  "password_iterations": 100000,
  "reload_templates": false,
  "require_device_email": true,
  "rsa_key_filename": "data/rsa_key",
  "sends_folder": "data/sends",
  "show_password_hint": false,
  "signups_allowed": false,
  "signups_domains_whitelist": "",
  "signups_verify": true,
  "signups_verify_resend_limit": 6,
  "signups_verify_resend_time": 3600,
  "smtp_accept_invalid_certs": false,
  "smtp_accept_invalid_hostnames": false,
  "smtp_auth_mechanism": "Login",
  "smtp_debug": false,
  "smtp_explicit_tls": false,
  "smtp_from": "*****@*******.***",
  "smtp_from_name": "*****",
  "smtp_host": "**********.**.**",
  "smtp_password": "***",
  "smtp_port": 25,
  "smtp_ssl": true,
  "smtp_timeout": 15,
  "smtp_username": "********",
  "templates_folder": "data/templates",
  "use_syslog": true,
  "user_attachment_limit": null,
  "web_vault_enabled": true,
  "web_vault_folder": "/opt/bw/web-vault/",
  "websocket_address": "127.0.0.1",
  "websocket_enabled": true,
  "websocket_port": 3012,
  "yubico_client_id": "***",
  "yubico_secret_key": "***",
  "yubico_server": null
}

Steps to reproduce

git clone latest master

 cargo build --features mysql --release
...
...

warning: unused import: `chrono::prelude::*`
 --> src/db/mod.rs:1:5
  |
1 | use chrono::prelude::*;
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unreachable expression
   --> src/db/mod.rs:236:5
    |
144 | /         match $conn {
145 | |             $($(
146 | |                 #[cfg($db)]
147 | |                 crate::db::DbConn::$db(ref $conn) => {
...   |
150 | |             )+)+
151 | |         }
    | |_________- any code following this `match` expression is unreachable, as all arms diverge
...
236 |       Ok(())
    |       ^^^^^^ unreachable expression
    |
    = note: `#[warn(unreachable_code)]` on by default

warning: 2 warnings emitted

    Finished release [optimized] target(s) in 13m 25s

Expected behaviour

Finished release [optimized] target(s), without warnings

Actual behaviour

2 Warnings emmited

Troubleshooting data

Here we have CentOS8 latest, Release: CentOS Linux release 8.3.2011

So, question ist should we worry? We have special needs and use only compiled binary since 2019, without any warnings ever.

Originally created by @Obivatelj on GitHub. <!-- # ### NOTE: Please update to the latest version of vaultwarden before reporting an issue! This saves you and us a lot of time and troubleshooting. See: * https://github.com/dani-garcia/vaultwarden/issues/1180 * https://github.com/dani-garcia/vaultwarden/wiki/Updating-the-vaultwarden-image # ### --> <!-- Please fill out the following template to make solving your problem easier and faster for us. This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them. Remember to hide/redact personal or confidential information, such as passwords, IP addresses, and DNS names as appropriate. --> ### Subject of the issue Self-compiled Binary Warning ### Deployment environment rustup show Default host: x86_64-unknown-linux-gnu rustup home: /root/.rustup installed toolchains -------------------- stable-x86_64-unknown-linux-gnu (default) nightly-2021-04-14-x86_64-unknown-linux-gnu nightly-x86_64-unknown-linux-gnu active toolchain ---------------- nightly-2021-04-14-x86_64-unknown-linux-gnu (overridden by '/tmp/vaultwarden/rust-toolchain') rustc 1.53.0-nightly (132b4e5d1 2021-04-13) ### Your environment (Generated via diagnostics page) * Bitwarden_rs version: v1.20.0-5c5700ca * Web-vault version: v2.19.0d * Running within Docker: false * Uses a reverse proxy: true * IP Header check: true (X-Real-IP) * Internet access: false * Internet access via a proxy: false * DNS Check: true * Time Check: true * Domain Configuration Check: true * HTTPS Check: true * Database type: MySQL * Database version: 8.0.21 * Clients used: * Reverse proxy and version: nginx + haproxy * Other relevant information: ### Config (Generated via diagnostics page) ```json { "_duo_akey": null, "_enable_duo": false, "_enable_email_2fa": true, "_enable_smtp": true, "_enable_yubico": true, "_ip_header_enabled": true, "admin_token": "***", "allowed_iframe_ancestors": "", "attachments_folder": "data/attachments", "authenticator_disable_time_drift": false, "data_folder": "data", "database_max_conns": 10, "database_url": "*****://**:********************************@*********:****/****", "db_connection_retries": 15, "disable_2fa_remember": false, "disable_admin_token": false, "disable_icon_download": true, "domain": "*****://*****.*******.***", "domain_origin": "*****://*****.*******.***", "domain_path": "", "domain_set": true, "duo_host": null, "duo_ikey": null, "duo_skey": null, "email_attempts_limit": 3, "email_expiration_time": 600, "email_token_size": 6, "enable_db_wal": false, "extended_logging": true, "helo_name": null, "hibp_api_key": null, "icon_blacklist_non_global_ips": true, "icon_blacklist_regex": null, "icon_cache_folder": "data/icon_cache", "icon_cache_negttl": 259200, "icon_cache_ttl": 0, "icon_download_timeout": 10, "invitation_org_name": "*****", "invitations_allowed": true, "ip_header": "X-Real-IP", "log_file": "/var/log/bitwarden_rs/bitwarden_rs.log", "log_level": "info", "log_timestamp_format": "%Y-%m-%d %H:%M:%S.%3f", "org_attachment_limit": null, "org_creation_users": "*.*****@*******.**,*******-******-*********@**********.**", "password_iterations": 100000, "reload_templates": false, "require_device_email": true, "rsa_key_filename": "data/rsa_key", "sends_folder": "data/sends", "show_password_hint": false, "signups_allowed": false, "signups_domains_whitelist": "", "signups_verify": true, "signups_verify_resend_limit": 6, "signups_verify_resend_time": 3600, "smtp_accept_invalid_certs": false, "smtp_accept_invalid_hostnames": false, "smtp_auth_mechanism": "Login", "smtp_debug": false, "smtp_explicit_tls": false, "smtp_from": "*****@*******.***", "smtp_from_name": "*****", "smtp_host": "**********.**.**", "smtp_password": "***", "smtp_port": 25, "smtp_ssl": true, "smtp_timeout": 15, "smtp_username": "********", "templates_folder": "data/templates", "use_syslog": true, "user_attachment_limit": null, "web_vault_enabled": true, "web_vault_folder": "/opt/bw/web-vault/", "websocket_address": "127.0.0.1", "websocket_enabled": true, "websocket_port": 3012, "yubico_client_id": "***", "yubico_secret_key": "***", "yubico_server": null } ``` ### Steps to reproduce git clone latest master ``` cargo build --features mysql --release ... ... warning: unused import: `chrono::prelude::*` --> src/db/mod.rs:1:5 | 1 | use chrono::prelude::*; | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unreachable expression --> src/db/mod.rs:236:5 | 144 | / match $conn { 145 | | $($( 146 | | #[cfg($db)] 147 | | crate::db::DbConn::$db(ref $conn) => { ... | 150 | | )+)+ 151 | | } | |_________- any code following this `match` expression is unreachable, as all arms diverge ... 236 | Ok(()) | ^^^^^^ unreachable expression | = note: `#[warn(unreachable_code)]` on by default warning: 2 warnings emitted Finished release [optimized] target(s) in 13m 25s ``` ### Expected behaviour Finished release [optimized] target(s), without warnings ### Actual behaviour 2 Warnings emmited ### Troubleshooting data Here we have CentOS8 latest, Release: CentOS Linux release 8.3.2011 So, question ist should we worry? We have special needs and use only compiled binary since 2019, without any warnings ever.
Author
Owner

@dani-garcia commented on GitHub:

It's not an issue, just happens that we import some things that we only use with SQLite, so when compiling without it you get that warning.

That said I changed the code so the warning doesn't appear in commit 1e5306b820

@dani-garcia commented on GitHub: It's not an issue, just happens that we import some things that we only use with SQLite, so when compiling without it you get that warning. That said I changed the code so the warning doesn't appear in commit 1e5306b8203a7ebe24047910e6c690c18c6d827a
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#1397