Skip to content

Commit

Permalink
fixed clippy warnings, which should make CI run successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
jofas committed Aug 4, 2024
1 parent 11aa75a commit 340367a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# display_json
# `display_json`

[![Build Status](https://github.com/jofas/display_json/actions/workflows/build.yml/badge.svg)](https://github.com/jofas/display_json/actions/workflows/build.yml)
[![Latest Version](https://img.shields.io/crates/v/display_json.svg)](https://crates.io/crates/display_json)
Expand All @@ -25,13 +25,6 @@ deserialization capabilities into the traits from `std`.
## Table of Contents

<!--ts-->
* [Serializing objects to json with rust std's fmt traits](#serializing-objects-to-json-with-rust-stds-fmt-traits)
* [DisplayAsJson](#displayasjson)
* [DebugAsJson](#debugasjson)
* [Pretty json](#pretty-json)
* [Mixing Display and Debug](#mixing-display-and-debug)
* [Deserializing objects from json with rust std's FromStr trait](#deserializing-objects-from-json-with-rust-stds-fromstr-trait)
* [FromStrAsJson](#fromstrasjson)
<!--te-->


Expand All @@ -53,7 +46,7 @@ the `to_string` and `to_string_pretty` functions from the
implementation of `Display` or `Debug` for your type.


### DisplayAsJson
### `DisplayAsJson`

Without `display_json`, you'd have to serialize your object to a json
string like this:
Expand Down Expand Up @@ -129,7 +122,7 @@ println!("{}", f);
```


### DebugAsJson
### `DebugAsJson`

`DebugAsJson` works the same as `DisplayAsJson`, only instead of
implementing the `Display` trait, it implements the `Debug` trait:
Expand Down Expand Up @@ -198,7 +191,7 @@ for the body of an http request and `DebugAsJsonPretty` for creating
well-readable debugging messages for you to debug your code.


## Deserializing objects from json with rust std's FromStr trait
## Deserializing objects from json with rust std's `FromStr` trait

While deserialization of json strings is usually done by integrating
your program directly with the [serde](https://serde.rs) and
Expand All @@ -219,7 +212,7 @@ custom format with a parser just to cumbersomely write an
implementation for `FromStr` by hand, `display_json` is a great
choice.

### FromStrAsJson
### `FromStrAsJson`

`display_json` exposes the `FromStrAsJson` custom derive procedural
macro you can derive on your type.
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ macro_rules! derive_fmt_as_json {
fn serialize_in_generics(g: &Generics) -> Punctuated<GenericParam, Comma> {
let mut params = Punctuated::<GenericParam, Comma>::new();

for param in g.params.iter() {
for param in &g.params {
let param = match param {
GenericParam::Type(typ) => {
let mut typ = typ.clone();
Expand All @@ -45,7 +45,7 @@ fn serialize_in_generics(g: &Generics) -> Punctuated<GenericParam, Comma> {
fn deserialize_in_generics(g: &Generics) -> Punctuated<GenericParam, Comma> {
let mut params = Punctuated::<GenericParam, Comma>::new();

for param in g.params.iter() {
for param in &g.params {
let param = match param {
GenericParam::Type(typ) => {
let mut typ = typ.clone();
Expand Down

0 comments on commit 340367a

Please sign in to comment.