Fix #! (shebang) stripping account space issue #70528

This commit is contained in:
Ayush Kumar Mishra 2020-04-21 11:44:00 +05:30
parent dbf8b6bf11
commit 0315864260

View File

@ -236,7 +236,7 @@ pub enum Base {
/// (e.g. "#![deny(missing_docs)]").
pub fn strip_shebang(input: &str) -> Option<usize> {
debug_assert!(!input.is_empty());
if !input.starts_with("#!") || input.starts_with("#![") {
if !input.starts_with("#!") || input.starts_with("#![") || input.starts_with("#! [") {
return None;
}
Some(input.find('\n').unwrap_or(input.len()))