Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: impl Display for DebugType #2258

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crates/noirc_frontend/src/hir/def_collector/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use thiserror::Error;

use std::fmt;

#[derive(Debug)]
pub enum DuplicateType {
Function,
Module,
Expand All @@ -18,7 +19,7 @@ pub enum DuplicateType {

#[derive(Error, Debug)]
pub enum DefCollectorErrorKind {
#[error("duplicate {typ:?} found in namespace")]
#[error("duplicate {typ} found in namespace")]
Duplicate { typ: DuplicateType, first_def: Ident, second_def: Ident },
#[error("unresolved import")]
UnresolvedModuleDecl { mod_name: Ident },
Expand All @@ -36,7 +37,7 @@ impl DefCollectorErrorKind {
}
}

impl fmt::Debug for DuplicateType {
impl fmt::Display for DuplicateType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DuplicateType::Function => write!(f, "function"),
Expand All @@ -53,7 +54,7 @@ impl From<DefCollectorErrorKind> for Diagnostic {
match error {
DefCollectorErrorKind::Duplicate { typ, first_def, second_def } => {
let primary_message = format!(
"duplicate definitions of {:?} with name {} found",
"duplicate definitions of {} with name {} found",
&typ, &first_def.0.contents
);
{
Expand Down