Introduce InnerSpan abstraction
This should be used when trying to get at subsets of a larger span, especially when the larger span is not available in the code attempting to work with those subsets (especially common in the fmt_macros crate). This is usually a good replacement for (BytePos, BytePos) and (usize, usize) tuples. This commit also removes from_inner_byte_pos, since it took usize arguments, which is error prone.
This commit is contained in:
parent
a859440092
commit
b1c357e0c3
6 changed files with 82 additions and 75 deletions
|
@ -2,7 +2,7 @@ use errors::Applicability;
|
|||
use syntax::parse::lexer::{StringReader as Lexer};
|
||||
use syntax::parse::{ParseSess, token};
|
||||
use syntax::source_map::FilePathMapping;
|
||||
use syntax_pos::FileName;
|
||||
use syntax_pos::{InnerSpan, FileName};
|
||||
|
||||
use crate::clean;
|
||||
use crate::core::DocContext;
|
||||
|
@ -63,7 +63,7 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
|
|||
}
|
||||
|
||||
if code_block.syntax.is_none() && code_block.is_fenced {
|
||||
let sp = sp.from_inner_byte_pos(0, 3);
|
||||
let sp = sp.from_inner(InnerSpan::new(0, 3));
|
||||
diag.span_suggestion(
|
||||
sp,
|
||||
"mark blocks that do not contain Rust code as text",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue