mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Use indentation
consistently (#12293)
This commit is contained in:
parent
90e9aae3f4
commit
b6545ce5d6
5 changed files with 56 additions and 54 deletions
|
@ -36,7 +36,7 @@ impl<'a> Stylist<'a> {
|
|||
}
|
||||
|
||||
pub fn from_tokens(tokens: &Tokens, locator: &'a Locator<'a>) -> Self {
|
||||
let indentation = detect_indention(tokens, locator);
|
||||
let indentation = detect_indentation(tokens, locator);
|
||||
|
||||
Self {
|
||||
locator,
|
||||
|
@ -60,7 +60,7 @@ fn detect_quote(tokens: &[Token]) -> Quote {
|
|||
Quote::default()
|
||||
}
|
||||
|
||||
fn detect_indention(tokens: &[Token], locator: &Locator) -> Indentation {
|
||||
fn detect_indentation(tokens: &[Token], locator: &Locator) -> Indentation {
|
||||
let indent_range = tokens.iter().find_map(|token| {
|
||||
if matches!(token.kind(), TokenKind::Indent) {
|
||||
Some(token.range())
|
||||
|
@ -204,7 +204,7 @@ x = (
|
|||
let stylist = Stylist::from_tokens(parsed.tokens(), &locator);
|
||||
assert_eq!(stylist.indentation(), &Indentation(" ".to_string()));
|
||||
|
||||
// formfeed indent, see `detect_indention` comment.
|
||||
// formfeed indent, see `detect_indentation` comment.
|
||||
let contents = r"
|
||||
class FormFeedIndent:
|
||||
def __init__(self, a=[]):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue