misc: more aggressive linting for quality~

This commit is contained in:
Kat Marchán 2021-08-21 23:13:25 -07:00
parent ffee3753f0
commit 949174e598
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
5 changed files with 13 additions and 8 deletions

View File

@ -10,7 +10,7 @@ use ChainState::*;
#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub struct Chain<'a> {
pub(crate) struct Chain<'a> {
state: crate::chain::ChainState<'a>,
}
@ -25,7 +25,7 @@ pub(crate) enum ChainState<'a> {
}
impl<'a> Chain<'a> {
pub fn new(head: &'a (dyn StdError + 'static)) -> Self {
pub(crate) fn new(head: &'a (dyn StdError + 'static)) -> Self {
Chain {
state: ChainState::Linked { next: Some(head) },
}

View File

@ -1,7 +1,6 @@
#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
// #![deny(missing_docs, missing_debug_implementations, nonstandard_style)]
// #![warn(unreachable_pub, rust_2018_idioms)]
#![deny(missing_docs, missing_debug_implementations, nonstandard_style)]
#![warn(unreachable_pub, rust_2018_idioms)]
pub use miette_derive::*;

View File

@ -9,8 +9,13 @@ use once_cell::sync::OnceCell;
use crate::protocol::{Diagnostic, DiagnosticReportPrinter, Severity};
use crate::MietteError;
// NOTE(zkat): I don't understand why these three are "unreachable" when
// they're clearly being exported? Maybe a bug?
#[allow(unreachable_pub)]
pub use graphical_printer::*;
#[allow(unreachable_pub)]
pub use narratable_printer::*;
#[allow(unreachable_pub)]
pub use theme::*;
mod graphical_printer;
@ -54,6 +59,7 @@ fn get_default_printer() -> Box<dyn DiagnosticReportPrinter + Send + Sync + 'sta
}
/// Literally what it says on the tin.
#[derive(Debug, Clone)]
pub struct JokePrinter;
impl DiagnosticReportPrinter for JokePrinter {

View File

@ -79,7 +79,7 @@ impl NarratableReportPrinter {
Ok(())
}
fn render_snippet(&self, f: &mut impl fmt::Write, snippet: &DiagnosticSnippet) -> fmt::Result {
fn render_snippet(&self, f: &mut impl fmt::Write, snippet: &DiagnosticSnippet<'_>) -> fmt::Result {
let (contents, lines) = self.get_lines(snippet)?;
write!(f, "Begin snippet")?;
@ -127,7 +127,7 @@ impl NarratableReportPrinter {
fn get_lines<'a>(
&'a self,
snippet: &'a DiagnosticSnippet,
snippet: &'a DiagnosticSnippet<'a>,
) -> Result<(Box<dyn SpanContents + 'a>, Vec<Line>), fmt::Error> {
let context_data = snippet
.source

View File

@ -40,7 +40,7 @@ pub trait Diagnostic: std::error::Error {
/// Additional contextual snippets. This is typically used for adding
/// marked-up source file output the way compilers often do.
fn snippets(&self) -> Option<Box<dyn Iterator<Item = DiagnosticSnippet> + '_>> {
fn snippets(&self) -> Option<Box<dyn Iterator<Item = DiagnosticSnippet<'_>> + '_>> {
None
}
}