forked from extern/nushell
Clippy fixes from stable and nightly (#13455)
- **Doccomment style fixes** - **Forgotten stuff in `nu-pretty-hex`** - **Don't `for` around an `Option`** - and more I think the suggestions here are a net positive, some of the suggestions moved into #13498 feel somewhat arbitrary, I also raised https://github.com/rust-lang/rust-clippy/issues/13188 as the nightly `byte_char_slices` would require either a global allow or otherwise a ton of granular allows or possibly confusing bytestring literals.
This commit is contained in:
committed by
GitHub
parent
928c57db41
commit
42531e017c
@ -169,11 +169,7 @@ pub fn parse_def_predecl(working_set: &mut StateWorkingSet, spans: &[Span]) {
|
||||
|
||||
// Now, pos should point at the next span after the def-like call.
|
||||
// Skip all potential flags, like --env, --wrapped or --help:
|
||||
while pos < spans.len()
|
||||
&& working_set
|
||||
.get_span_contents(spans[pos])
|
||||
.starts_with(&[b'-'])
|
||||
{
|
||||
while pos < spans.len() && working_set.get_span_contents(spans[pos]).starts_with(b"-") {
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
@ -202,12 +198,8 @@ pub fn parse_def_predecl(working_set: &mut StateWorkingSet, spans: &[Span]) {
|
||||
let mut signature_pos = None;
|
||||
|
||||
while pos < spans.len() {
|
||||
if working_set
|
||||
.get_span_contents(spans[pos])
|
||||
.starts_with(&[b'['])
|
||||
|| working_set
|
||||
.get_span_contents(spans[pos])
|
||||
.starts_with(&[b'('])
|
||||
if working_set.get_span_contents(spans[pos]).starts_with(b"[")
|
||||
|| working_set.get_span_contents(spans[pos]).starts_with(b"(")
|
||||
{
|
||||
signature_pos = Some(pos);
|
||||
break;
|
||||
@ -424,7 +416,7 @@ pub fn parse_def(
|
||||
let mut decl_name_span = None;
|
||||
|
||||
for span in rest_spans {
|
||||
if !working_set.get_span_contents(*span).starts_with(&[b'-']) {
|
||||
if !working_set.get_span_contents(*span).starts_with(b"-") {
|
||||
decl_name_span = Some(*span);
|
||||
break;
|
||||
}
|
||||
@ -554,7 +546,7 @@ pub fn parse_def(
|
||||
for arg_name in &signature.optional_positional {
|
||||
verify_not_reserved_variable_name(working_set, &arg_name.name, sig.span);
|
||||
}
|
||||
for arg_name in &signature.rest_positional {
|
||||
if let Some(arg_name) = &signature.rest_positional {
|
||||
verify_not_reserved_variable_name(working_set, &arg_name.name, sig.span);
|
||||
}
|
||||
for flag_name in &signature.get_names() {
|
||||
|
@ -5926,7 +5926,7 @@ pub fn discover_captures_in_closure(
|
||||
seen.push(var_id);
|
||||
}
|
||||
}
|
||||
for positional in &block.signature.rest_positional {
|
||||
if let Some(positional) = &block.signature.rest_positional {
|
||||
if let Some(var_id) = positional.var_id {
|
||||
seen.push(var_id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user