From bfe1efca26a9ae07d44ca3cc79ffdc4342f72b44 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 23 Oct 2020 12:08:55 +0200 Subject: Use format_to Co-authored-by: Aleksey Kladov --- crates/hir_def/src/diagnostics.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/hir_def/src') diff --git a/crates/hir_def/src/diagnostics.rs b/crates/hir_def/src/diagnostics.rs index 34a6a8d4b..532496b62 100644 --- a/crates/hir_def/src/diagnostics.rs +++ b/crates/hir_def/src/diagnostics.rs @@ -1,13 +1,12 @@ //! Diagnostics produced by `hir_def`. use std::any::Any; -use std::fmt::Write; +use stdx::format_to; use cfg::{CfgExpr, CfgOptions, DnfExpr}; use hir_expand::diagnostics::{Diagnostic, DiagnosticCode}; -use syntax::{ast, AstPtr, SyntaxNodePtr}; - use hir_expand::{HirFileId, InFile}; +use syntax::{ast, AstPtr, SyntaxNodePtr}; // Diagnostic: unresolved-module // @@ -109,7 +108,7 @@ impl Diagnostic for InactiveCode { let mut buf = "code is inactive due to #[cfg] directives".to_string(); if let Some(inactive) = inactive { - write!(buf, ": {}", inactive).unwrap(); + format_to!(buf, ": {}", inactive); } buf -- cgit v1.2.3