mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
chore: Prefer tracing span shorthand macros
This commit is contained in:
parent
5f3de7863a
commit
27182bb96b
82 changed files with 240 additions and 275 deletions
|
@ -120,7 +120,7 @@ pub struct TreeDiff {
|
|||
|
||||
impl TreeDiff {
|
||||
pub fn into_text_edit(&self, builder: &mut TextEditBuilder) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "into_text_edit").entered();
|
||||
let _p = tracing::info_span!("into_text_edit").entered();
|
||||
|
||||
for (anchor, to) in &self.insertions {
|
||||
let offset = match anchor {
|
||||
|
@ -149,7 +149,7 @@ impl TreeDiff {
|
|||
///
|
||||
/// This function tries to find a fine-grained diff.
|
||||
pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "diff").entered();
|
||||
let _p = tracing::info_span!("diff").entered();
|
||||
|
||||
let mut diff = TreeDiff {
|
||||
replacements: FxHashMap::default(),
|
||||
|
|
|
@ -185,7 +185,7 @@ impl ast::Expr {
|
|||
/// ast::Expr::parse("let fail = true;", Edition::CURRENT).tree();
|
||||
/// ```
|
||||
pub fn parse(text: &str, edition: Edition) -> Parse<ast::Expr> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "Expr::parse").entered();
|
||||
let _p = tracing::info_span!("Expr::parse").entered();
|
||||
let (green, errors) = parsing::parse_text_at(text, parser::TopEntryPoint::Expr, edition);
|
||||
let root = SyntaxNode::new_root(green.clone());
|
||||
|
||||
|
@ -203,7 +203,7 @@ pub use crate::ast::SourceFile;
|
|||
|
||||
impl SourceFile {
|
||||
pub fn parse(text: &str, edition: Edition) -> Parse<SourceFile> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
|
||||
let _p = tracing::info_span!("SourceFile::parse").entered();
|
||||
let (green, errors) = parsing::parse_text(text, edition);
|
||||
let root = SyntaxNode::new_root(green.clone());
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::{syntax_node::GreenNode, SyntaxError, SyntaxTreeBuilder};
|
|||
pub(crate) use crate::parsing::reparsing::incremental_reparse;
|
||||
|
||||
pub(crate) fn parse_text(text: &str, edition: parser::Edition) -> (GreenNode, Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse_text").entered();
|
||||
let _p = tracing::info_span!("parse_text").entered();
|
||||
let lexed = parser::LexedStr::new(text);
|
||||
let parser_input = lexed.to_input();
|
||||
let parser_output = parser::TopEntryPoint::SourceFile.parse(&parser_input, edition);
|
||||
|
@ -23,7 +23,7 @@ pub(crate) fn parse_text_at(
|
|||
entry: parser::TopEntryPoint,
|
||||
edition: parser::Edition,
|
||||
) -> (GreenNode, Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse_text_at").entered();
|
||||
let _p = tracing::info_span!("parse_text_at").entered();
|
||||
let lexed = parser::LexedStr::new(text);
|
||||
let parser_input = lexed.to_input();
|
||||
let parser_output = entry.parse(&parser_input, edition);
|
||||
|
@ -35,7 +35,7 @@ pub(crate) fn build_tree(
|
|||
lexed: parser::LexedStr<'_>,
|
||||
parser_output: parser::Output,
|
||||
) -> (GreenNode, Vec<SyntaxError>, bool) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "build_tree").entered();
|
||||
let _p = tracing::info_span!("build_tree").entered();
|
||||
let mut builder = SyntaxTreeBuilder::default();
|
||||
|
||||
let is_eof = lexed.intersperse_trivia(&parser_output, &mut |step| match step {
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub(crate) fn validate(root: &SyntaxNode, errors: &mut Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parser::validate").entered();
|
||||
let _p = tracing::info_span!("parser::validate").entered();
|
||||
// FIXME:
|
||||
// * Add unescape validation of raw string literals and raw byte string literals
|
||||
// * Add validation of doc comments are being attached to nodes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue