We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4be882 commit 82fd867Copy full SHA for 82fd867
vm/src/stdlib/io.rs
@@ -2750,15 +2750,13 @@ mod _io {
2750
let data = obj.as_str();
2751
2752
let replace_nl = match textio.newline {
2753
+ Newlines::Lf => Some("\n"),
2754
Newlines::Cr => Some("\r"),
2755
Newlines::Crlf => Some("\r\n"),
2756
+ Newlines::Universal if cfg!(windows) => Some("\r\n"),
2757
_ => None,
2758
};
- let has_lf = if replace_nl.is_some() || textio.line_buffering {
- data.contains('\n')
2759
- } else {
2760
- false
2761
- };
+ let has_lf = (replace_nl.is_some() || textio.line_buffering) && data.contains('\n');
2762
let flush = textio.line_buffering && (has_lf || data.contains('\r'));
2763
let chunk = if let Some(replace_nl) = replace_nl {
2764
if has_lf {
0 commit comments