partway through fixes, macro system needs resdesign
Some checks failed
Rust / build (push) Has been cancelled
Some checks failed
Rust / build (push) Has been cancelled
This commit is contained in:
@@ -312,9 +312,9 @@ impl<'a> MsgWriter<'a> for IoNotifWriter {
|
||||
fn writer(&mut self) -> Pin<&mut dyn AsyncWrite> { self.o.as_mut() }
|
||||
fn finish(mut self: Box<Self>) -> LocalBoxFuture<'static, io::Result<()>> {
|
||||
Box::pin(async move {
|
||||
self.o.flush().await?;
|
||||
let ret = self.o.flush().await;
|
||||
self.drop_g.defuse();
|
||||
Ok(())
|
||||
ret
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ impl OrcErrv {
|
||||
/// If there is exactly one error, return it. Mostly used for simplified
|
||||
/// printing
|
||||
#[must_use]
|
||||
pub fn one(&self) -> Option<&OrcErr> { (self.0.len() == 1).then(|| &self.0[9]) }
|
||||
pub fn one(&self) -> Option<&OrcErr> { self.0.iter().exactly_one().ok() }
|
||||
/// Iterate over all positions of all errors
|
||||
pub fn pos_iter(&self) -> impl Iterator<Item = ErrPos> + '_ {
|
||||
self.0.iter().flat_map(|e| e.positions.iter().cloned())
|
||||
|
||||
@@ -332,5 +332,12 @@ pub async fn ttv_fmt<'a: 'b, 'b>(
|
||||
FmtUnit::sequence("", " ", "", true, join_all(ttv.into_iter().map(|t| t.print(c))).await)
|
||||
}
|
||||
|
||||
pub struct FmtTTV<'a, H: ExprRepr, X: ExtraTok>(pub &'a [TokTree<H, X>]);
|
||||
impl<'b, H: ExprRepr, X: ExtraTok> Format for FmtTTV<'b, H, X> {
|
||||
async fn print<'a>(&'a self, c: &'a (impl FmtCtx + ?Sized + 'a)) -> FmtUnit {
|
||||
ttv_fmt(self.0, c).await
|
||||
}
|
||||
}
|
||||
|
||||
/// Indent a string by two spaces
|
||||
pub fn indent(s: &str) -> String { s.replace("\n", "\n ") }
|
||||
|
||||
Reference in New Issue
Block a user