We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
extract_comments_to_line
1 parent ac5d704 commit 2fd2b91Copy full SHA for 2fd2b91
librubyfmt/src/file_comments.rs
@@ -212,17 +212,17 @@ impl FileComments {
212
line_number: LineNumber,
213
) -> Option<(CommentBlock, LineNumber)> {
214
let lowest_line = self.other_comments.first().map(|(ln, _)| *ln)?;
215
- let split_point = self
216
- .other_comments
217
- .partition_point(|(ln, _)| *ln <= line_number);
218
-
219
- if split_point == 0 {
+ if lowest_line > line_number {
220
return Some((
221
CommentBlock::new(lowest_line..line_number + 1, Vec::new()),
222
starting_line_number,
223
));
224
}
225
+ let split_point = self
+ .other_comments
+ .partition_point(|(ln, _)| *ln <= line_number);
+
226
let mut comment_block_with_spaces: Vec<String> = Vec::new();
227
let mut last_line = None;
228
0 commit comments