Skip to content

Commit

Permalink
Remove validate var
Browse files Browse the repository at this point in the history
Not sure why this is here. Maybe it used to need to be mutated in an old
incarnation of this code.
  • Loading branch information
dtolnay committed Jun 20, 2022
1 parent 83ed7b8 commit d918477
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/fallback.rs
Expand Up @@ -673,12 +673,11 @@ pub(crate) fn is_ident_continue(c: char) -> bool {
}

fn validate_ident(string: &str, raw: bool) {
let validate = string;
if validate.is_empty() {
if string.is_empty() {
panic!("Ident is not allowed to be empty; use Option<Ident>");
}

if validate.bytes().all(|digit| digit >= b'0' && digit <= b'9') {
if string.bytes().all(|digit| digit >= b'0' && digit <= b'9') {
panic!("Ident cannot be a number; use Literal instead");
}

Expand All @@ -696,7 +695,7 @@ fn validate_ident(string: &str, raw: bool) {
true
}

if !ident_ok(validate) {
if !ident_ok(string) {
panic!("{:?} is not a valid Ident", string);
}

Expand Down

0 comments on commit d918477

Please sign in to comment.