Skip to content

Commit

Permalink
use impl fmt::Write instead of Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjitjhala committed Dec 10, 2024
1 parent 6c0273a commit 83b868c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions crates/flux-middle/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! This crate contains common type definitions that are used by other crates.
#![allow(internal_features)] // TODO: needed for the fmt_internals, which is needed for `nested_with_bound_vars`
#![feature(
associated_type_defaults,
box_patterns,
Expand All @@ -10,8 +9,7 @@
min_specialization,
never_type,
rustc_private,
unwrap_infallible,
fmt_internals
unwrap_infallible
)]

extern crate rustc_ast;
Expand Down
2 changes: 1 addition & 1 deletion crates/flux-middle/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl<'genv, 'tcx> PrettyCx<'genv, 'tcx> {
left: &str,
vars: &[BoundVariableKind],
right: &str,
f: &mut fmt::Formatter<'_>,
f: &mut impl fmt::Write,
) -> fmt::Result {
define_scoped!(self, f);
w!("{left}")?;
Expand Down
3 changes: 1 addition & 2 deletions crates/flux-middle/src/rty/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,8 @@ pub fn nested_with_bound_vars(
f: impl FnOnce(String) -> Result<NestedString, fmt::Error>,
) -> Result<NestedString, fmt::Error> {
let mut buffer = String::new();
let mut formatter = fmt::Formatter::new(&mut buffer);
if !vars.is_empty() {
cx.fmt_bound_vars(false, left, vars, ". ", &mut formatter)?;
cx.fmt_bound_vars(false, left, vars, ". ", &mut buffer)?;
}
f(buffer)
}
Expand Down

0 comments on commit 83b868c

Please sign in to comment.