1
Fork 0

Fix clippy warnings

This commit is contained in:
Yuki Okushi 2019-10-01 13:43:30 +09:00
parent 22bc9e1d9c
commit f10d2e2d23
5 changed files with 16 additions and 17 deletions

View file

@ -1053,12 +1053,12 @@ impl Json {
/// a value associated with the provided key is found. If no value is found
/// or the Json value is not an Object, returns `None`.
pub fn search(&self, key: &str) -> Option<&Json> {
match self {
&Json::Object(ref map) => {
match *self {
Json::Object(ref map) => {
match map.get(key) {
Some(json_value) => Some(json_value),
None => {
for (_, v) in map {
for v in map.values() {
match v.search(key) {
x if x.is_some() => return x,
_ => ()
@ -1487,12 +1487,12 @@ impl<T: Iterator<Item=char>> Parser<T> {
}
fn parse_number(&mut self) -> JsonEvent {
let mut neg = false;
if self.ch_is('-') {
let neg = if self.ch_is('-') {
self.bump();
neg = true;
}
true
} else {
false
};
let res = match self.parse_u64() {
Ok(res) => res,
@ -2162,10 +2162,9 @@ impl crate::Decoder for Decoder {
let s = self.read_str()?;
{
let mut it = s.chars();
match (it.next(), it.next()) {
if let (Some(c), None) = (it.next(), it.next()) {
// exactly one character
(Some(c), None) => return Ok(c),
_ => ()
return Ok(c);
}
}
Err(ExpectedError("single character string".to_owned(), s.to_string()))