fix non_upper_case_globals lint

Closes #12648
This commit is contained in:
xtqqczze
2026-04-18 15:15:10 +01:00
committed by Johannes Altmanninger
parent 68472da48a
commit 86c052b6ba
5 changed files with 9 additions and 10 deletions

View File

@@ -196,7 +196,6 @@ tsan = []
[workspace.lints]
rust.non_camel_case_types = "allow"
rust.non_upper_case_globals = "allow"
rust.unknown_lints = { level = "allow", priority = -1 }
rust.unstable_name_collisions = "allow"
rustdoc.private_intra_doc_links = "allow"

View File

@@ -5,8 +5,8 @@
use crate::{builtins::error::Error, env::Environment as _, err_fmt, wutil::wrealpath};
// The pwd builtin. Respect -P to resolve symbolic links. Respect -L to not do that (the default).
const short_options: &wstr = L!("LPh");
const long_options: &[WOption] = &[
const SHORT_OPTIONS: &wstr = L!("LPh");
const LONG_OPTIONS: &[WOption] = &[
wopt(L!("help"), NoArgument, 'h'),
wopt(L!("logical"), NoArgument, 'L'),
wopt(L!("physical"), NoArgument, 'P'),
@@ -16,7 +16,7 @@ pub fn pwd(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Buil
let cmd = argv[0];
let argc = argv.len();
let mut resolve_symlinks = false;
let mut w = WGetopter::new(short_options, long_options, argv);
let mut w = WGetopter::new(SHORT_OPTIONS, LONG_OPTIONS, argv);
while let Some(opt) = w.next_opt() {
match opt {
'L' => resolve_symlinks = false,

View File

@@ -16,8 +16,8 @@ struct Options {
no_symlinks: bool,
}
const short_options: &wstr = L!("+hs");
const long_options: &[WOption] = &[
const SHORT_OPTIONS: &wstr = L!("+hs");
const LONG_OPTIONS: &[WOption] = &[
wopt(L!("no-symlinks"), NoArgument, 's'),
wopt(L!("help"), NoArgument, 'h'),
];
@@ -31,7 +31,7 @@ fn parse_options(
let mut opts = Options::default();
let mut w = WGetopter::new(short_options, long_options, args);
let mut w = WGetopter::new(SHORT_OPTIONS, LONG_OPTIONS, args);
while let Some(c) = w.next_opt() {
match c {

View File

@@ -5,7 +5,7 @@
use crate::exec::{PgroupPolicy, is_thompson_shell_script};
use crate::proc::Job;
use crate::redirection::Dup2List;
use crate::signal::signals_to_default;
use crate::signal::SIGNALS_TO_DEFAULT;
use errno::Errno;
use libc::{c_char, posix_spawn_file_actions_t, posix_spawnattr_t};
use std::ffi::{CStr, CString};
@@ -129,7 +129,7 @@ pub fn new(
}
// Everybody gets default handlers.
attr.set_sigdefault(&signals_to_default)?;
attr.set_sigdefault(&SIGNALS_TO_DEFAULT)?;
// Reset the sigmask.
let mut sigmask = MaybeUninit::uninit();

View File

@@ -273,7 +273,7 @@ pub fn signal_handle(sig: Signal) {
sigaction(sig, &act, std::ptr::null_mut());
}
pub static signals_to_default: LazyLock<libc::sigset_t> = LazyLock::new(|| {
pub static SIGNALS_TO_DEFAULT: LazyLock<libc::sigset_t> = LazyLock::new(|| {
let mut set = MaybeUninit::uninit();
unsafe { libc::sigemptyset(set.as_mut_ptr()) };
for data in SIGNAL_TABLE.iter() {