Skip to content

Commit 9e3dcb4

Browse files
committed
Simplify start_bpos calculation in scan_comment().
The two branches of this `if` compute the same value. This commit gets rid of the first branch, which makes this calculation identical to the one in scan_block_comment().
1 parent 49960ad commit 9e3dcb4

File tree

1 file changed

+1
-5
lines changed
  • src/libsyntax/parse/lexer

1 file changed

+1
-5
lines changed

Diff for: src/libsyntax/parse/lexer/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,7 @@ impl<'a> StringReader<'a> {
507507

508508
// line comments starting with "///" or "//!" are doc-comments
509509
let doc_comment = self.curr_is('/') || self.curr_is('!');
510-
let start_bpos = if doc_comment {
511-
self.pos - BytePos(3)
512-
} else {
513-
self.last_pos - BytePos(2)
514-
};
510+
let start_bpos = self.last_pos - BytePos(2);
515511

516512
while !self.is_eof() {
517513
match self.curr.unwrap() {

0 commit comments

Comments
 (0)