Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 9 additions & 9 deletions derive/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
//! https://docs.rs/syn/0.15.44/syn/enum.Type.html
//! https://ziglang.org/documentation/0.5.0/#toc-typeInfo

use alloc::collections::BTreeSet;
use core::iter::Peekable;
use core::num::IntErrorKind;

use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use alloc::{format, vec};
use ::alloc::collections::BTreeSet;
use ::core::iter::Peekable;
use ::core::num::IntErrorKind;

use ::alloc::borrow::ToOwned;
use ::alloc::boxed::Box;
use ::alloc::string::{String, ToString};
use ::alloc::vec::Vec;
use ::alloc::{format, vec};

use proc_macro::{Delimiter, Group, TokenStream, TokenTree};

Expand Down
4 changes: 2 additions & 2 deletions derive/src/serde_bin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloc::format;
use alloc::string::String;
use ::alloc::format;
use ::alloc::string::String;

use crate::{
parse::{Category, Enum, Struct, Type},
Expand Down
6 changes: 3 additions & 3 deletions derive/src/serde_json.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::format;
use alloc::string::{String, ToString};
use alloc::{vec, vec::Vec};
use ::alloc::format;
use ::alloc::string::{String, ToString};
use ::alloc::{vec, vec::Vec};

use crate::parse::{Category, Type};
use crate::shared::{enum_bounds_strings, struct_bounds_strings};
Expand Down
6 changes: 3 additions & 3 deletions derive/src/serde_ron.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use ::alloc::format;
use ::alloc::string::{String, ToString};
use ::alloc::vec::Vec;

use crate::{
parse::{Attribute, Category, Enum, Field, Struct, Type},
Expand Down
4 changes: 2 additions & 2 deletions derive/src/shared.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![cfg(any(feature = "json", feature = "ron", feature = "binary"))]

use crate::parse::{Enum, Struct};
use alloc::string::String;
use alloc::{format, string::ToString, vec::Vec};
use ::alloc::string::String;
use ::alloc::{format, string::ToString, vec::Vec};

macro_rules! l {
($target:ident, $line:expr) => {
Expand Down
16 changes: 8 additions & 8 deletions src/serde_bin.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use core::error::Error;
use core::{convert::TryInto, time::Duration};
use ::core::error::Error;
use ::core::{convert::TryInto, time::Duration};

use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use alloc::string::String;
use alloc::vec::Vec;
use ::alloc::borrow::ToOwned;
use ::alloc::boxed::Box;
use ::alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use ::alloc::string::String;
use ::alloc::vec::Vec;

/// A trait for objects that can be serialized to binary.
pub trait SerBin {
Expand Down Expand Up @@ -454,7 +454,7 @@ where
T: DeBin,
{
fn de_bin(o: &mut usize, d: &[u8]) -> Result<Self, DeBinErr> {
use core::mem::MaybeUninit;
use ::core::mem::MaybeUninit;

// waiting for uninit_array(or for array::try_from_fn) stabilization
// https://github.com/rust-lang/rust/issues/96097
Expand Down
16 changes: 8 additions & 8 deletions src/serde_json.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use core::str::Chars;
use core::{error::Error, fmt::Write, time::Duration};
use ::core::str::Chars;
use ::core::{error::Error, fmt::Write, time::Duration};

use alloc::boxed::Box;
use alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use ::alloc::boxed::Box;
use ::alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use ::alloc::format;
use ::alloc::string::{String, ToString};
use ::alloc::vec::Vec;

/// The internal state of a JSON serialization.
#[non_exhaustive]
Expand Down Expand Up @@ -1052,7 +1052,7 @@ where
T: DeJson,
{
fn de_json(o: &mut DeJsonState, d: &mut Chars) -> Result<Self, DeJsonErr> {
use core::mem::MaybeUninit;
use ::core::mem::MaybeUninit;

// waiting for uninit_array(or for array::try_from_fn) stabilization
// https://github.com/rust-lang/rust/issues/96097
Expand Down
16 changes: 8 additions & 8 deletions src/serde_ron.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use core::str::Chars;
use core::{error::Error, fmt::Write, time::Duration};
use ::core::str::Chars;
use ::core::{error::Error, fmt::Write, time::Duration};

use alloc::boxed::Box;
use alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use alloc::format;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use ::alloc::boxed::Box;
use ::alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use ::alloc::format;
use ::alloc::string::{String, ToString};
use ::alloc::vec::Vec;

/// The internal state of a RON serialization.
pub struct SerRonState {
Expand Down Expand Up @@ -1043,7 +1043,7 @@ where
T: DeRon,
{
fn de_ron(o: &mut DeRonState, d: &mut Chars) -> Result<Self, DeRonErr> {
use core::mem::MaybeUninit;
use ::core::mem::MaybeUninit;

// waiting for uninit_array(or for array::try_from_fn) stabilization
// https://github.com/rust-lang/rust/issues/96097
Expand Down
10 changes: 5 additions & 5 deletions src/toml.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::error::Error;
use core::str::Chars;
use ::core::error::Error;
use ::core::str::Chars;

use alloc::format;
use alloc::string::{String, ToString};
use alloc::{collections::BTreeMap, vec, vec::Vec};
use ::alloc::format;
use ::alloc::string::{String, ToString};
use ::alloc::{collections::BTreeMap, vec, vec::Vec};

/// Pattern matching any valid unquoted key character as u32.
/// ABNF line: https://github.com/toml-lang/toml/blob/2431aa308a7bc97eeb50673748606e23a6e0f201/toml.abnf#L55
Expand Down
2 changes: 1 addition & 1 deletion tests/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use std::{array, sync::atomic::AtomicBool};

use alloc::collections::{BTreeMap, BTreeSet, LinkedList};
use ::alloc::collections::{BTreeMap, BTreeSet, LinkedList};

use nanoserde::{DeBin, SerBin};

Expand Down Expand Up @@ -193,7 +193,7 @@
pub struct Test(i32, pub i32, pub(crate) String, f32, [u64; 100]);

#[derive(DeBin, SerBin, PartialEq)]
pub struct Vec2(pub(crate) f32, pub(crate) f32);

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test Individual Features (binary)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test Individual Features NoStd (binary)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, wasm32-unknown-unknown)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test No Std (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test No Std (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

struct `Vec2` is never constructed

Check warning on line 196 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Vec2` is never constructed

let test = Test(0, 1, "asd".to_string(), 2., [3_u64; 100]);
let bytes = SerBin::serialize_bin(&test);
Expand Down Expand Up @@ -245,7 +245,7 @@
#[test]
fn pub_tuple_struct() {
#[derive(DeBin, SerBin, PartialEq)]
struct Foo(pub [u8; 3]);

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test Individual Features (binary)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test Individual Features NoStd (binary)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, wasm32-unknown-unknown)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test No Std (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test No Std (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, x86_64-apple-darwin)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, x86_64-pc-windows-gnu)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, x86_64-pc-windows-msvc)

struct `Foo` is never constructed

Check warning on line 248 in tests/bin.rs

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, x86_64-unknown-linux-gnu)

struct `Foo` is never constructed
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion tests/ser_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use nanoserde::{DeJson, SerJson};
#[cfg(feature = "ron")]
use nanoserde::{DeRon, SerRon};

use alloc::collections::BTreeMap;
use ::alloc::collections::BTreeMap;

#[derive(Default, PartialEq, Debug)]
struct Test2 {
Expand Down
2 changes: 1 addition & 1 deletion tests/toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

extern crate alloc;

use alloc::collections::BTreeMap;
use ::alloc::collections::BTreeMap;
use nanoserde::Toml;
use nanoserde::TomlParser;

Expand Down
Loading