1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

[BEEEP] Add println clippy lints for desktop_native. (#16761)

* [BEEEP] Add println clippy lints for `desktop_native`.

* remaining stray printlns
This commit is contained in:
neuronull
2025-10-21 06:38:39 -07:00
committed by GitHub
parent 8a8076a6da
commit 8370f43aae
5 changed files with 9 additions and 3 deletions

View File

@@ -2586,6 +2586,7 @@ dependencies = [
"ctor 0.5.0", "ctor 0.5.0",
"desktop_core", "desktop_core",
"libc", "libc",
"tracing",
] ]
[[package]] [[package]]

View File

@@ -79,6 +79,10 @@ zbus_polkit = "=5.0.0"
zeroizing-alloc = "=0.1.0" zeroizing-alloc = "=0.1.0"
[workspace.lints.clippy] [workspace.lints.clippy]
# Dis-allow println and eprintln, which are typically used in debugging.
# Use `tracing` and `tracing-subscriber` crates for observability needs.
print_stderr = "deny"
print_stdout = "deny"
string_slice = "warn"
unused_async = "deny" unused_async = "deny"
unwrap_used = "deny" unwrap_used = "deny"
string_slice = "warn"

View File

@@ -331,7 +331,6 @@ mod tests {
fn get_alphabetic_hot_key_happy() { fn get_alphabetic_hot_key_happy() {
for c in ('a'..='z').chain('A'..='Z') { for c in ('a'..='z').chain('A'..='Z') {
let letter = c.to_string(); let letter = c.to_string();
println!("{}", letter);
let converted = get_alphabetic_hotkey(letter).unwrap(); let converted = get_alphabetic_hotkey(letter).unwrap();
assert_eq!(converted, c as u16); assert_eq!(converted, c as u16);
} }

View File

@@ -12,3 +12,4 @@ crate-type = ["cdylib"]
ctor = { workspace = true } ctor = { workspace = true }
desktop_core = { path = "../core" } desktop_core = { path = "../core" }
libc = { workspace = true } libc = { workspace = true }
tracing = { workspace = true }

View File

@@ -7,6 +7,7 @@
use desktop_core::process_isolation; use desktop_core::process_isolation;
use std::{ffi::c_char, sync::LazyLock}; use std::{ffi::c_char, sync::LazyLock};
use tracing::info;
static ORIGINAL_UNSETENV: LazyLock<unsafe extern "C" fn(*const c_char) -> i32> = static ORIGINAL_UNSETENV: LazyLock<unsafe extern "C" fn(*const c_char) -> i32> =
LazyLock::new(|| unsafe { LazyLock::new(|| unsafe {
@@ -38,8 +39,8 @@ unsafe extern "C" fn unsetenv(name: *const c_char) -> i32 {
#[ctor::ctor] #[ctor::ctor]
fn preload_init() { fn preload_init() {
let pid = unsafe { libc::getpid() }; let pid = unsafe { libc::getpid() };
info!(pid, "Enabling memory security for process.");
unsafe { unsafe {
println!("[Process Isolation] Enabling memory security for process {pid}");
process_isolation::isolate_process(); process_isolation::isolate_process();
process_isolation::disable_coredumps(); process_isolation::disable_coredumps();
} }