Address some non_upper_case_globals lints

This commit is contained in:
Johannes Altmanninger
2025-12-18 11:57:06 +01:00
parent 03a3a3b52f
commit 81e1f6937f
12 changed files with 27 additions and 27 deletions

View File

@@ -180,7 +180,7 @@ fn abbr_show(streams: &mut IoStreams) -> BuiltinResult {
// Print the list of abbreviation names.
fn abbr_list(opts: &Options, streams: &mut IoStreams) -> BuiltinResult {
const subcmd: &wstr = L!("--list");
let subcmd = L!("--list");
if !opts.args.is_empty() {
streams.err.append(wgettext_fmt!(
"%s %s: Unexpected argument -- '%s'\n",
@@ -203,7 +203,7 @@ fn abbr_list(opts: &Options, streams: &mut IoStreams) -> BuiltinResult {
// Rename an abbreviation, deleting any existing one with the given name.
fn abbr_rename(opts: &Options, streams: &mut IoStreams) -> BuiltinResult {
const subcmd: &wstr = L!("--rename");
let subcmd = L!("--rename");
if opts.args.len() != 2 {
streams.err.append(wgettext_fmt!(
@@ -305,7 +305,7 @@ fn abbr_query(opts: &Options) -> BuiltinResult {
// Add a named abbreviation.
fn abbr_add(opts: &Options, streams: &mut IoStreams) -> BuiltinResult {
const subcmd: &wstr = L!("--add");
let subcmd = L!("--add");
if opts.args.len() < 2 && opts.function.is_none() {
streams.err.append(wgettext_fmt!(
@@ -484,9 +484,9 @@ pub fn abbr(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Bui
// Note the leading '-' causes wgetopter to return arguments in order, instead of permuting
// them. We need this behavior for compatibility with pre-builtin abbreviations where options
// could be given literally, for example `abbr e emacs -nw`.
const short_options: &wstr = L!("-ac:f:r:seqgUh");
let short_options: &wstr = L!("-ac:f:r:seqgUh");
const longopts: &[WOption] = &[
let longopts: &[WOption] = &[
wopt(L!("add"), ArgType::NoArgument, 'a'),
wopt(L!("command"), ArgType::RequiredArgument, 'c'),
wopt(L!("position"), ArgType::RequiredArgument, 'p'),

View File

@@ -12,8 +12,8 @@ pub fn r#builtin(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -
let print_hints = false;
let mut opts: builtin_cmd_opts_t = Default::default();
const shortopts: &wstr = L!("hnq");
const longopts: &[WOption] = &[
let shortopts: &wstr = L!("hnq");
let longopts: &[WOption] = &[
wopt(L!("help"), ArgType::NoArgument, 'h'),
wopt(L!("names"), ArgType::NoArgument, 'n'),
wopt(L!("query"), ArgType::NoArgument, 'q'),

View File

@@ -14,8 +14,8 @@ pub fn r#command(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -
let print_hints = false;
let mut opts: command_cmd_opts_t = Default::default();
const shortopts: &wstr = L!("hasqv");
const longopts: &[WOption] = &[
let shortopts: &wstr = L!("hasqv");
let longopts: &[WOption] = &[
wopt(L!("help"), ArgType::NoArgument, 'h'),
wopt(L!("all"), ArgType::NoArgument, 'a'),
wopt(L!("query"), ArgType::NoArgument, 'q'),

View File

@@ -66,8 +66,8 @@ struct HistoryCmdOpts {
/// the non-flag subcommand form. While many of these flags are deprecated they must be
/// supported at least until fish 3.0 and possibly longer to avoid breaking everyones
/// config.fish and other scripts.
const short_options: &wstr = L!("CRcehmn:pt::z");
const longopts: &[WOption] = &[
const SHORT_OPTIONS: &wstr = L!("CRcehmn:pt::z");
const LONG_OPTIONS: &[WOption] = &[
wopt(L!("prefix"), ArgType::NoArgument, 'p'),
wopt(L!("contains"), ArgType::NoArgument, 'c'),
wopt(L!("help"), ArgType::NoArgument, 'h'),
@@ -144,7 +144,7 @@ fn parse_cmd_opts(
return Err(STATUS_INVALID_ARGS);
};
let mut w = WGetopter::new(short_options, longopts, argv);
let mut w = WGetopter::new(SHORT_OPTIONS, LONG_OPTIONS, argv);
while let Some(opt) = w.next_opt() {
match opt {
'\x01' => {

View File

@@ -33,7 +33,7 @@ fn parse_cmd_opts(
parser: &Parser,
streams: &mut IoStreams,
) -> Result<(Options, usize), ErrorCode> {
const cmd: &wstr = L!("math");
let cmd = L!("math");
let print_hints = true;
// This command is atypical in using the "+" (REQUIRE_ORDER) option for flag parsing.

View File

@@ -15,8 +15,8 @@ pub fn random(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> B
let argc = argv.len();
let print_hints = false;
const shortopts: &wstr = L!("+h");
const longopts: &[WOption] = &[wopt(L!("help"), ArgType::NoArgument, 'h')];
let shortopts: &wstr = L!("+h");
let longopts: &[WOption] = &[wopt(L!("help"), ArgType::NoArgument, 'h')];
let mut w = WGetopter::new(shortopts, longopts, argv);
#[allow(clippy::never_loop)]

View File

@@ -737,8 +737,8 @@ pub fn parse(
let cmd = args[0];
let print_hints = true;
const shortopts: &wstr = L!("+h");
const longopts: &[WOption] = &[wopt(L!("help"), ArgType::NoArgument, 'h')];
let shortopts: &wstr = L!("+h");
let longopts: &[WOption] = &[wopt(L!("help"), ArgType::NoArgument, 'h')];
let mut print_help = false;
let mut w = WGetopter::new(shortopts, longopts, args);

View File

@@ -23,8 +23,8 @@ pub fn r#type(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> B
let print_hints = false;
let mut opts: type_cmd_opts_t = Default::default();
const shortopts: &wstr = L!("hasftpPq");
const longopts: &[WOption] = &[
let shortopts: &wstr = L!("hasftpPq");
let longopts: &[WOption] = &[
wopt(L!("help"), ArgType::NoArgument, 'h'),
wopt(L!("all"), ArgType::NoArgument, 'a'),
wopt(L!("short"), ArgType::NoArgument, 's'),

View File

@@ -140,8 +140,8 @@ pub fn wait(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Bui
let mut print_help = false;
let print_hints = false;
const shortopts: &wstr = L!("nh");
const longopts: &[WOption] = &[
let shortopts: &wstr = L!("nh");
let longopts: &[WOption] = &[
wopt(L!("any"), ArgType::NoArgument, 'n'),
wopt(L!("help"), ArgType::NoArgument, 'h'),
];

View File

@@ -37,8 +37,8 @@
/// Return the length of the slice starting at `in`, or 0 if there is no slice, or None on error.
/// This never accepts incomplete slices.
pub fn parse_util_slice_length(input: &wstr) -> Option<usize> {
const openc: char = '[';
const closec: char = ']';
let openc = '[';
let closec = ']';
let mut escaped = false;
// Check for initial opening [
@@ -2082,7 +2082,7 @@ macro_rules! validate {
#[serial]
fn test_parse_util_cmdsubst_extent() {
let _cleanup = test_init();
const a: &wstr = L!("echo (echo (echo hi");
let a = L!("echo (echo (echo hi");
assert_eq!(parse_util_cmdsubst_extent(a, 0), 0..a.len());
assert_eq!(parse_util_cmdsubst_extent(a, 1), 0..a.len());
assert_eq!(parse_util_cmdsubst_extent(a, 2), 0..a.len());

View File

@@ -362,7 +362,7 @@ pub fn post(&self, topic: Topic) {
// Beware, we may be in a signal handler!
// Atomically update the pending topics.
let topicbit = topic_to_bit(topic);
const relaxed: Ordering = Ordering::Relaxed;
let relaxed = Ordering::Relaxed;
// CAS in our bit, capturing the old status value.
let mut oldstatus: StatusBits = 0;
@@ -405,7 +405,7 @@ fn updated_gens_in_data(&self, data: &mut MutexGuard<data_t>) -> GenerationsList
// Atomically acquire the pending updates, swapping in 0.
// If there are no pending updates (likely) or a thread is waiting, just return.
// Otherwise CAS in 0 and update our topics.
const relaxed: Ordering = Ordering::Relaxed;
let relaxed = Ordering::Relaxed;
let mut changed_topic_bits: TopicBitmask = 0;
let mut cas_success = false;
while !cas_success {

View File

@@ -607,7 +607,7 @@ fn norm_path(path: &wstr) -> WString {
fn test_wdirname_wbasename() {
// path, dir, base
struct Test(&'static wstr, &'static wstr, &'static wstr);
const testcases: &[Test] = &[
let testcases: &[Test] = &[
Test(L!(""), L!("."), L!(".")),
Test(L!("foo//"), L!("."), L!("foo")),
Test(L!("foo//////"), L!("."), L!("foo")),