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

Minor clippy lint fixes. #1006

Merged
merged 1 commit into from
Mar 22, 2024
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
21 changes: 5 additions & 16 deletions prost-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,36 +205,26 @@ pub trait ServiceGenerator {

/// The map collection type to output for Protobuf `map` fields.
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Default, Clone, Copy, Debug, PartialEq)]
enum MapType {
/// The [`std::collections::HashMap`] type.
#[default]
HashMap,
/// The [`std::collections::BTreeMap`] type.
BTreeMap,
}

impl Default for MapType {
fn default() -> MapType {
MapType::HashMap
}
}

/// The bytes collection type to output for Protobuf `bytes` fields.
#[non_exhaustive]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Default, Clone, Copy, Debug, PartialEq)]
enum BytesType {
/// The [`alloc::collections::Vec::<u8>`] type.
#[default]
Vec,
/// The [`bytes::Bytes`] type.
Bytes,
}

impl Default for BytesType {
fn default() -> BytesType {
BytesType::Vec
}
}

/// Configuration options for Protobuf code generation.
///
/// This configuration builder can be used to set non-default code generation options.
Expand Down Expand Up @@ -1559,7 +1549,6 @@ mod tests {
use std::cell::RefCell;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use std::rc::Rc;

use super::*;
Expand Down Expand Up @@ -1726,7 +1715,7 @@ mod tests {

// Prior to PR introducing this test, the generated include file would have the file
// google.protobuf.rs which was an empty file. Now that file should only exist if it has content
if let Ok(mut f) = File::open(&previously_empty_proto_path) {
if let Ok(mut f) = File::open(previously_empty_proto_path) {
// Since this file was generated, it should not be empty.
let mut contents = String::new();
f.read_to_string(&mut contents).unwrap();
Expand Down
Loading