Skip to content

Commit

Permalink
Minor clippy lint fixes. (#1006)
Browse files Browse the repository at this point in the history
  • Loading branch information
gibbz00 committed Mar 22, 2024
1 parent 82d7774 commit 0bd9482
Showing 1 changed file with 5 additions and 16 deletions.
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

0 comments on commit 0bd9482

Please sign in to comment.