Skip to content

Commit 1b702aa

Browse files
committed
Format
1 parent 7dddc5c commit 1b702aa

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

parser/src/parser.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,6 @@ class Foo(A, B):
636636
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
637637
}
638638

639-
640639
#[test]
641640
#[cfg(feature = "all-nodes-with-ranges")]
642641
fn test_parse_class_generic_types() {
@@ -868,7 +867,6 @@ except* OSError as e:
868867
assert!(parse(source, Mode::Interactive, "<embedded>").is_ok());
869868
}
870869

871-
872870
#[test]
873871
#[cfg(feature = "all-nodes-with-ranges")]
874872
fn test_parse_type_declaration() {
@@ -896,11 +894,14 @@ type = lambda query: query == event
896894
print(type(12))
897895
"#;
898896

899-
use crate::lexer::lex;
900-
let lexer = lex(source, Mode::Module);
901-
println!("tokens {:#?}", lexer.map(|x| x.unwrap().0).collect::<Vec<_>>());
897+
use crate::lexer::lex;
898+
let lexer = lex(source, Mode::Module);
899+
println!(
900+
"tokens {:#?}",
901+
lexer.map(|x| x.unwrap().0).collect::<Vec<_>>()
902+
);
902903

903-
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
904+
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
904905
}
905906

906907
#[test]
@@ -929,7 +930,7 @@ match match:
929930
match = lambda query: query == event
930931
print(match(12))
931932
"#;
932-
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
933+
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
933934
}
934935

935936
#[test]

parser/src/soft_keywords.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use itertools::{Itertools, MultiPeek};
88
/// as soft keywords, meaning that they can be used as identifiers (e.g., variable names) in certain
99
/// contexts.
1010
///
11-
/// Later, [PEP 695](https://peps.python.org/pep-0695/#generic-type-alias) introduced the `type`
11+
/// Later, [PEP 695](https://peps.python.org/pep-0695/#generic-type-alias) introduced the `type`
1212
/// soft keyword.
13-
///
13+
///
1414
/// This function modifies a token stream to accommodate this change. In particular, it replaces
1515
/// soft keyword tokens with `identifier` tokens if they are used as identifiers.
1616
///
@@ -46,10 +46,10 @@ where
4646
fn next(&mut self) -> Option<LexResult> {
4747
let mut next = self.underlying.next();
4848
if let Some(Ok((tok, range))) = next.as_ref() {
49-
// If the token is a soft keyword e.g. `type`, `match`, or `case`, check if it's
49+
// If the token is a soft keyword e.g. `type`, `match`, or `case`, check if it's
5050
// used as an identifier. We assume every soft keyword use is an identifier unless
5151
// a heuristic is met.
52-
52+
5353
// For `match` and `case`, all of the following conditions must be met:
5454
// 1. The token is at the start of a logical line.
5555
// 2. The logical line contains a top-level colon (that is, a colon that is not nested
@@ -112,7 +112,6 @@ where
112112
next = Some(Ok((soft_to_name(tok), *range)));
113113
}
114114
}
115-
116115
}
117116
}
118117

0 commit comments

Comments
 (0)