Skip to content

Read the original file for comparing/detecting newline #4236

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

Merged
merged 1 commit into from
Jun 7, 2020

Conversation

topecongiro
Copy link
Contributor

Close #4097.

@topecongiro topecongiro force-pushed the windows-newline-issues branch from bbe7fa1 to 0cf74df Compare June 6, 2020 08:39
std::io::Error::from(std::io::ErrorKind::InvalidInput),
))?)?,
};
apply_newline_style(config.newline_style(), &mut visitor.buffer, &original_text);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to pass the original file content to apply_newline_style.

@@ -206,13 +206,6 @@ impl ParseSess {
Rc::clone(source_file.src.as_ref().unwrap()),
)
}

pub(crate) fn get_original_snippet(&self, file_name: &FileName) -> Option<Rc<String>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is no longer used, and thus removed.

@@ -62,9 +62,6 @@ impl SnippetProvider {
}
}

pub(crate) fn entire_snippet(&self) -> &str {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is no longer used, and thus removed.

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@topecongiro topecongiro merged commit a441d5e into rust-lang:master Jun 7, 2020
@topecongiro topecongiro deleted the windows-newline-issues branch June 7, 2020 02:46
@calebcartwright calebcartwright added 1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release and removed backport-triage labels May 29, 2022
@ytmimi ytmimi mentioned this pull request Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newline style changes to Unix-style when file is modified
3 participants