Skip to content

Commit 07ea961

Browse files
committed
remove implicit uses of std
1 parent 7232a1e commit 07ea961

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/arbitrary.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
use crate::{PointerBuf, Token};
2+
use alloc::{
3+
boxed::Box,
4+
string::{String, ToString},
5+
vec::Vec,
6+
};
27
use quickcheck::Arbitrary;
38

49
impl Arbitrary for Token {
@@ -7,8 +12,7 @@ impl Arbitrary for Token {
712
}
813

914
fn shrink(&self) -> Box<dyn Iterator<Item = Self>> {
10-
let s = self.to_string();
11-
Box::new(s.shrink().map(Self::new))
15+
Box::new(ToString::to_string(self).shrink().map(Self::new))
1216
}
1317
}
1418

src/pointer.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl Pointer {
504504
match token.as_str() {
505505
"0" => {
506506
// first element will be traversed when we recurse
507-
*dest = vec![Value::Null].into();
507+
*dest = alloc::vec![Value::Null].into();
508508
}
509509
"-" => {
510510
// new element will be appended when we recurse
@@ -994,14 +994,13 @@ impl core::fmt::Display for PointerBuf {
994994

995995
#[cfg(test)]
996996
mod tests {
997+
use super::*;
998+
use crate::{Resolve, ResolveMut};
999+
use alloc::vec;
9971000
use quickcheck::TestResult;
9981001
use quickcheck_macros::quickcheck;
9991002
use serde_json::json;
10001003

1001-
use crate::{Resolve, ResolveMut};
1002-
1003-
use super::*;
1004-
10051004
#[test]
10061005
#[should_panic]
10071006
fn from_const_validates() {
@@ -1603,11 +1602,7 @@ mod tests {
16031602
while let Some(token) = ptr.pop_back() {
16041603
tokens.push(token);
16051604
}
1606-
if dbg!(ptr.count() != 0)
1607-
|| dbg!(!ptr.is_root())
1608-
|| dbg!(ptr.last().is_some())
1609-
|| dbg!(ptr.first().is_some())
1610-
{
1605+
if ptr.count() != 0 || !ptr.is_root() || ptr.last().is_some() || ptr.first().is_some() {
16111606
return false;
16121607
}
16131608
for token in tokens.drain(..) {
@@ -1619,11 +1614,7 @@ mod tests {
16191614
while let Some(token) = ptr.pop_front() {
16201615
tokens.push(token);
16211616
}
1622-
if dbg!(ptr.count() != 0)
1623-
|| dbg!(!ptr.is_root())
1624-
|| dbg!(ptr.last().is_some())
1625-
|| dbg!(ptr.first().is_some())
1626-
{
1617+
if ptr.count() != 0 || !ptr.is_root() || ptr.last().is_some() || ptr.first().is_some() {
16271618
return false;
16281619
}
16291620
for token in tokens {
@@ -1658,7 +1649,7 @@ mod tests {
16581649
}
16591650
}
16601651
{
1661-
let fmt = format!("/{}{tail}", head.encoded());
1652+
let fmt = alloc::format!("/{}{tail}", head.encoded());
16621653
if Pointer::parse(&fmt).unwrap() != ptr {
16631654
return false;
16641655
}
@@ -1693,7 +1684,7 @@ mod tests {
16931684
}
16941685
}
16951686
{
1696-
let fmt = format!("{head}/{}", tail.encoded());
1687+
let fmt = alloc::format!("{head}/{}", tail.encoded());
16971688
if Pointer::parse(&fmt).unwrap() != ptr {
16981689
return false;
16991690
}

0 commit comments

Comments
 (0)