mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 03:51:20 -03:00
Address some non_upper_case_globals lints
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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' => {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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'),
|
||||
];
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")),
|
||||
|
||||
Reference in New Issue
Block a user