refact: suppress warns on macos (#12449)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-08-18 15:09:11 +08:00
committed by GitHub
parent bf24869c6a
commit a22f2108c6
20 changed files with 150 additions and 82 deletions

View File

@@ -8,7 +8,7 @@ use std::{
use serde_json::{json, Map, Value};
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[cfg(not(target_os = "ios"))]
use hbb_common::whoami;
use hbb_common::{
allow_err,
@@ -776,12 +776,22 @@ pub fn username() -> String {
return DEVICE_NAME.lock().unwrap().clone();
}
// Exactly the implementation of "whoami::hostname()".
// This wrapper is to suppress warnings.
#[inline(always)]
#[cfg(not(target_os = "ios"))]
pub fn whoami_hostname() -> String {
let mut hostname = whoami::fallible::hostname().unwrap_or_else(|_| "localhost".to_string());
hostname.make_ascii_lowercase();
hostname
}
#[inline]
pub fn hostname() -> String {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
#[allow(unused_mut)]
let mut name = whoami::hostname();
let mut name = whoami_hostname();
// some time, there is .local, some time not, so remove it for osx
#[cfg(target_os = "macos")]
if name.ends_with(".local") {
@@ -1723,7 +1733,7 @@ pub fn is_custom_client() -> bool {
get_app_name() != "RustDesk"
}
pub fn verify_login(raw: &str, id: &str) -> bool {
pub fn verify_login(_raw: &str, _id: &str) -> bool {
true
/*
if is_custom_client() {