diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2020-03-24 20:55:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 23:55:54 -0400 |
commit | 3938071e91e7c3dcf7b4e727601e1e99005aceab (patch) | |
tree | cb028150a1850bb96b898f24f7f59f6c41318af0 /cli/compilers | |
parent | eeedb416c098c50a05292cbbd8135b7050a5ce0e (diff) |
errors: replace .lines with explicit .split newline (#4483)
Diffstat (limited to 'cli/compilers')
-rw-r--r-- | cli/compilers/ts.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index 4f822dc2c..a74e4a096 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -553,7 +553,9 @@ impl SourceMapGetter for TsCompiler { .try_resolve_and_get_source_file(script_name) .and_then(|out| { str::from_utf8(&out.source_code).ok().and_then(|v| { - let lines: Vec<&str> = v.lines().collect(); + // Do NOT use .lines(): it skips the terminating empty line. + // (due to internally using .split_terminator() instead of .split()) + let lines: Vec<&str> = v.split('\n').collect(); assert!(lines.len() > line); Some(lines[line].to_string()) }) |