Skip to content

Commit

Permalink
Simplify Debug impl of Column
Browse files Browse the repository at this point in the history
  • Loading branch information
bikeshedder committed Dec 5, 2023
1 parent 02bab67 commit 8787615
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tokio-postgres/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub async fn prepare(
name: field.name().to_string(),
table_oid: NonZeroU32::new(field.table_oid()),
column_id: NonZeroI16::new(field.column_id()),
type_,
r#type: type_,
};
columns.push(column);
}
Expand Down
17 changes: 3 additions & 14 deletions tokio-postgres/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::connection::RequestMessages;
use crate::types::Type;
use postgres_protocol::message::frontend;
use std::{
fmt,
num::{NonZeroI16, NonZeroU32},
sync::{Arc, Weak},
};
Expand Down Expand Up @@ -66,11 +65,12 @@ impl Statement {
}

/// Information about a column of a query.
#[derive(Debug)]
pub struct Column {
pub(crate) name: String,
pub(crate) table_oid: Option<NonZeroU32>,
pub(crate) column_id: Option<NonZeroI16>,
pub(crate) type_: Type,
pub(crate) r#type: Type,
}

impl Column {
Expand All @@ -91,17 +91,6 @@ impl Column {

/// Returns the type of the column.
pub fn type_(&self) -> &Type {
&self.type_
}
}

impl fmt::Debug for Column {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Column")
.field("name", &self.name)
.field("table_oid", &self.table_oid)
.field("column_id", &self.column_id)
.field("type", &self.type_)
.finish()
&self.r#type
}
}

0 comments on commit 8787615

Please sign in to comment.