style: move postfix comments to line above

These comments should be placed on top of the line they're commenting on.
Multi-line postfix comments will no longer be aligned using rustfmt's
style edition 2024, so fix this now to prevent formatting issues later.
For consistency, single-line postfix comments are also moved.

Part of #11959
This commit is contained in:
Daniel Rainer
2025-10-16 17:20:11 +02:00
committed by Johannes Altmanninger
parent 41636c8e35
commit 1c3a6a463d
3 changed files with 24 additions and 15 deletions

View File

@@ -849,8 +849,9 @@ pub fn read_unquoted_escape(
let mut result_char_or_none: Option<char> = None; let mut result_char_or_none: Option<char> = None;
let mut errored = false; let mut errored = false;
let mut in_pos = 1; // in_pos always tracks the next character to read (and therefore the number // in_pos always tracks the next character to read
// of characters read so far) // (and therefore the number of characters read so far)
let mut in_pos = 1;
// For multibyte \X sequences. // For multibyte \X sequences.
let mut byte_buff: Vec<u8> = vec![]; let mut byte_buff: Vec<u8> = vec![];

View File

@@ -4373,15 +4373,20 @@ fn select_completion_in_direction(
/// Restore terminal settings we care about, to prevent a broken shell. /// Restore terminal settings we care about, to prevent a broken shell.
fn term_fix_modes(modes: &mut libc::termios) { fn term_fix_modes(modes: &mut libc::termios) {
modes.c_iflag &= !ICRNL; // disable mapping CR (\cM) to NL (\cJ) // disable mapping CR (\cM) to NL (\cJ)
modes.c_iflag &= !INLCR; // disable mapping NL (\cJ) to CR (\cM) modes.c_iflag &= !ICRNL;
modes.c_lflag &= !ICANON; // turn off canonical mode // disable mapping NL (\cJ) to CR (\cM)
modes.c_lflag &= !ECHO; // turn off echo mode modes.c_iflag &= !INLCR;
modes.c_lflag &= !IEXTEN; // turn off handling of discard and lnext characters // turn off canonical mode
modes.c_oflag |= OPOST; // turn on "implementation-defined post processing" - this often modes.c_lflag &= !ICANON;
// changes how line breaks work. // turn off echo mode
modes.c_oflag |= ONLCR; // "translate newline to carriage return-newline" - without modes.c_lflag &= !ECHO;
// you see staircase output. // turn off handling of discard and lnext characters
modes.c_lflag &= !IEXTEN;
// turn on "implementation-defined post processing" - this often changes how line breaks work.
modes.c_oflag |= OPOST;
// "translate newline to carriage return-newline" - without you see staircase output.
modes.c_oflag |= ONLCR;
modes.c_cc[VMIN] = 1; modes.c_cc[VMIN] = 1;
modes.c_cc[VTIME] = 0; modes.c_cc[VTIME] = 0;

View File

@@ -1333,8 +1333,9 @@ fn consume_char_whitespace(&mut self, c: char) -> bool {
while self.state != S_END && !consumed { while self.state != S_END && !consumed {
match self.state { match self.state {
S_ALWAYS_ONE => { S_ALWAYS_ONE => {
consumed = true; // always consume the first character // always consume the first character
// If it's not whitespace, only consume those from here. // If it's not whitespace, only consume those from here.
consumed = true;
if !c.is_whitespace() { if !c.is_whitespace() {
self.state = S_GRAPH; self.state = S_GRAPH;
} else { } else {
@@ -1344,14 +1345,16 @@ fn consume_char_whitespace(&mut self, c: char) -> bool {
} }
S_BLANK => { S_BLANK => {
if c.is_whitespace() { if c.is_whitespace() {
consumed = true; // consumed whitespace // consumed whitespace
consumed = true;
} else { } else {
self.state = S_GRAPH; self.state = S_GRAPH;
} }
} }
S_GRAPH => { S_GRAPH => {
if !c.is_whitespace() { if !c.is_whitespace() {
consumed = true; // consumed printable non-space // consumed printable non-space
consumed = true;
} else { } else {
self.state = S_END; self.state = S_END;
} }