Skip to content

Commit 9b55ad1

Browse files
committed
use config variable
1 parent 78fbdfd commit 9b55ad1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/formatting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn should_skip_module<T: FormatHandler>(
8282
let source_file = context.parse_session.span_to_file_contents(module.span);
8383
let src = source_file.src.as_ref().expect("SourceFile without src");
8484

85-
if is_generated_file(src, config.generated_marker_line_search_limit()) {
85+
if is_generated_file(src, config) {
8686
return true;
8787
}
8888
}

src/formatting/generated.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
use crate::Config;
2+
13
/// Returns `true` if the given span is a part of generated files.
2-
pub(super) fn is_generated_file(original_snippet: &str, header_size: usize) -> bool {
4+
pub(super) fn is_generated_file(original_snippet: &str, config: &Config) -> bool {
35
original_snippet
46
.lines()
5-
.take(header_size) // looking for marker only in the beginning of the file
7+
// looking for marker only in the beginning of the file
8+
.take(config.generated_marker_line_search_limit())
69
.any(|line| line.contains("@generated"))
710
}

0 commit comments

Comments
 (0)