Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Oct 8, 2024
1 parent 1163a59 commit afc16ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
15 changes: 0 additions & 15 deletions edb/server/pgrust/src/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ impl PgServerError {

/// Iterate all the fields of this error.
pub fn fields(&self) -> impl Iterator<Item = (PgServerErrorField, &str)> {
<<<<<<< HEAD
PgServerErrorFieldIterator::new(self)
}
}
Expand Down Expand Up @@ -385,20 +384,6 @@ impl<'a> Iterator for PgServerErrorFieldIterator<'a> {

fn next(&mut self) -> Option<Self::Item> {
self.iter.next()
=======
let fields = [
(PgServerErrorField::Code, self.code.get_error_string()),
(PgServerErrorField::Message, self.message.as_str()),
(
PgServerErrorField::SeverityNonLocalized,
self.severity.as_ref(),
),
];
Iterator::chain(
fields.into_iter(),
self.extra.iter().map(|(f, e)| (*f, e.as_str())),
)
>>>>>>> 65208d9e1 (Polish)
}
}

Expand Down
9 changes: 3 additions & 6 deletions edb/server/pgrust/src/handshake/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,13 @@ mod tests {
if initial {
server_error |= server
.drive(
ConnectionDrive::Initial(InitialMessage::new(&msg).unwrap()),
ConnectionDrive::Initial(InitialMessage::new(&msg)),
&mut pipe,
)
.is_err();
} else {
server_error |= server
.drive(
ConnectionDrive::Message(Message::new(&msg).unwrap()),
&mut pipe,
)
.drive(ConnectionDrive::Message(Message::new(&msg)), &mut pipe)
.is_err();
}
}
Expand All @@ -272,7 +269,7 @@ mod tests {
} else {
client_error |= client
.drive(
client::ConnectionDrive::Message(Message::new(&msg).unwrap()),
client::ConnectionDrive::Message(Message::new(&msg)),
&mut pipe,
)
.is_err();
Expand Down
8 changes: 4 additions & 4 deletions edb/server/pgrust/src/protocol/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<M: StructLength> StructBuffer<M> {
while offset < bytes.len() {
if let Some(len) = M::length_of_buf(&bytes[offset..]) {
if offset + len <= bytes.len() {
f(M::new(&bytes[offset..offset + len]).unwrap());
f(M::new(&bytes[offset..offset + len]));
offset += len;
} else {
break;
Expand All @@ -62,7 +62,7 @@ impl<M: StructLength> StructBuffer<M> {
while let Some(len) = M::length_of_buf(&contiguous[total_processed..]) {
if total_processed + len <= contiguous.len() {
let message_bytes = &contiguous[total_processed..total_processed + len];
f(M::new(message_bytes).unwrap());
f(M::new(message_bytes));
total_processed += len;
} else {
break;
Expand Down Expand Up @@ -103,7 +103,7 @@ impl<M: StructLength> StructBuffer<M> {
while offset < bytes.len() {
if let Some(len) = M::length_of_buf(&bytes[offset..]) {
if offset + len <= bytes.len() {
f(M::new(&bytes[offset..offset + len]).unwrap())?;
f(M::new(&bytes[offset..offset + len]))?;
offset += len;
} else {
break;
Expand All @@ -126,7 +126,7 @@ impl<M: StructLength> StructBuffer<M> {
while let Some(len) = M::length_of_buf(&contiguous[total_processed..]) {
if total_processed + len <= contiguous.len() {
let message_bytes = &contiguous[total_processed..total_processed + len];
f(M::new(message_bytes).unwrap())?;
f(M::new(message_bytes))?;
total_processed += len;
} else {
break;
Expand Down
4 changes: 2 additions & 2 deletions edb/server/pgrust/src/protocol/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,11 @@ macro_rules! basic_types {
(out[i], buf) = if let Some((bytes, rest)) = buf.split_first_chunk() {
(<$ty>::from_be_bytes(*bytes), rest)
} else {
return Err($crate::protocol::ParseError::TooShort)
panic!()
};
i += 1;
}
Ok(out)
out
}
}

Expand Down
2 changes: 1 addition & 1 deletion edb/server/pgrust/src/protocol/message_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub(crate) use message_group;
/// use pgrust::protocol::messages::*;
///
/// let buf = [b'?', 0, 0, 0, 4];
/// match_message!(Message::new(&buf).unwrap(), Backend {
/// match_message!(Message::new(&buf), Backend {
/// (BackendKeyData as data) => {
/// todo!();
/// },
Expand Down

0 comments on commit afc16ce

Please sign in to comment.