rustfmt_nightly/formatting/generated.rs
1use crate::Config;
2
3/// Returns `true` if the given span is a part of generated files.
4pub(super) fn is_generated_file(original_snippet: &str, config: &Config) -> bool {
5 original_snippet
6 .lines()
7 // looking for marker only in the beginning of the file
8 .take(config.generated_marker_line_search_limit())
9 .any(|line| line.contains("@generated"))
10}