Skip to content

Commit

Permalink
Fix some of the things current Clippy complains about (#2363)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold authored Apr 16, 2024
1 parent b493743 commit 4708171
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion common/src/bitset.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::io::Write;
use std::{fmt, io, u64};
use std::{fmt, io};

use ownedbytes::OwnedBytes;

Expand Down
11 changes: 6 additions & 5 deletions src/aggregation/bucket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mod term_agg;
mod term_missing_agg;

use std::collections::HashMap;
use std::fmt;

pub use histogram::*;
pub use range::*;
Expand Down Expand Up @@ -72,12 +73,12 @@ impl From<&str> for OrderTarget {
}
}

impl ToString for OrderTarget {
fn to_string(&self) -> String {
impl fmt::Display for OrderTarget {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
OrderTarget::Key => "_key".to_string(),
OrderTarget::Count => "_count".to_string(),
OrderTarget::SubAggregation(agg) => agg.to_string(),
OrderTarget::Key => f.write_str("_key"),
OrderTarget::Count => f.write_str("_count"),
OrderTarget::SubAggregation(agg) => agg.fmt(f),
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/aggregation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ use itertools::Itertools;
use serde::de::{self, Visitor};
use serde::{Deserialize, Deserializer, Serialize};

pub(crate) fn invalid_agg_request(message: String) -> crate::TantivyError {
crate::TantivyError::AggregationError(AggregationError::InvalidRequest(message))
}

fn parse_str_into_f64<E: de::Error>(value: &str) -> Result<f64, E> {
let parsed = value.parse::<f64>().map_err(|_err| {
de::Error::custom(format!("Failed to parse f64 from string: {:?}", value))
Expand Down
2 changes: 1 addition & 1 deletion src/collector/facet_collector.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::cmp::Ordering;
use std::collections::{btree_map, BTreeMap, BTreeSet, BinaryHeap};
use std::io;
use std::ops::Bound;
use std::{io, u64, usize};

use crate::collector::{Collector, SegmentCollector};
use crate::fastfield::FacetReader;
Expand Down
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ pub struct Version {

impl fmt::Debug for Version {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to_string())
fmt::Display::fmt(self, f)
}
}

Expand All @@ -266,9 +266,10 @@ static VERSION: Lazy<Version> = Lazy::new(|| Version {
index_format_version: INDEX_FORMAT_VERSION,
});

impl ToString for Version {
fn to_string(&self) -> String {
format!(
impl fmt::Display for Version {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"tantivy v{}.{}.{}, index_format v{}",
self.major, self.minor, self.patch, self.index_format_version
)
Expand Down
1 change: 0 additions & 1 deletion sstable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::io::{self, Write};
use std::ops::Range;
use std::usize;

use merge::ValueMerger;

Expand Down

0 comments on commit 4708171

Please sign in to comment.