Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix replace_whitespace() tabulation to space #4226

Merged
merged 4 commits into from
May 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use chars for columns and not char width.
  • Loading branch information
MichaReiser committed May 8, 2023
commit 7527fcde1bb030746dbe69a3dc49347fff33224e
4 changes: 1 addition & 3 deletions crates/ruff/src/message/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use ruff_text_size::{TextRange, TextSize};
use std::borrow::Cow;
use std::fmt::{Display, Formatter};
use std::io::Write;
use unicode_width::UnicodeWidthChar;

bitflags! {
#[derive(Default)]
Expand Down Expand Up @@ -276,9 +275,8 @@ fn replace_whitespace(source: &str, annotation_range: TextRange) -> SourceCode {
'\n' | '\r' => {
column = 0;
}
#[allow(clippy::cast_possible_truncation)]
_ => {
column += c.width().unwrap_or(0) as u32;
column += 1;
}
}
}
Expand Down
Loading