iff->if or if and only if (#1298)

* has_xxx is_xxx -> if, these function usualy define equivalence
xxx returns bool -> specify equivalence when appropriate

* fix doc
This commit is contained in:
Antoine G
2022-03-02 03:00:00 +01:00
committed by GitHub
parent 5004290daa
commit e37775fe21
23 changed files with 39 additions and 39 deletions

View File

@@ -173,8 +173,7 @@ impl<T: PartialOrd + Clone> TopSegmentCollector<T> {
.collect()
}
/// Return true iff at least K documents have gone through
/// the collector.
/// Return true if more documents have been collected than the limit.
#[inline]
pub(crate) fn at_capacity(&self) -> bool {
self.heap.len() >= self.limit

View File

@@ -70,7 +70,7 @@ impl SegmentReader {
self.max_doc - self.num_docs
}
/// Returns true iff some of the documents of the segment have been deleted.
/// Returns true if some of the documents of the segment have been deleted.
pub fn has_deletes(&self) -> bool {
self.num_deleted_docs() > 0
}
@@ -301,7 +301,7 @@ impl SegmentReader {
self.alive_bitset_opt.as_ref()
}
/// Returns true iff the `doc` is marked
/// Returns true if the `doc` is marked
/// as deleted.
pub fn is_deleted(&self, doc: DocId) -> bool {
self.alive_bitset()

View File

@@ -128,7 +128,7 @@ pub trait Directory: DirectoryClone + fmt::Debug + Send + Sync + 'static {
/// `DeleteError::DoesNotExist`.
fn delete(&self, path: &Path) -> Result<(), DeleteError>;
/// Returns true iff the file exists
/// Returns true if and only if the file exists
fn exists(&self, path: &Path) -> Result<bool, OpenReadError>;
/// Opens a writer for the *virtual file* associated with

View File

@@ -16,7 +16,7 @@ use crate::directory::{
use crate::error::DataCorruption;
use crate::Directory;
/// Returns true iff the file is "managed".
/// Returns true if the file is "managed".
/// Non-managed file are not subject to garbage collection.
///
/// Filenames that starts by a "." -typically locks-

View File

@@ -61,13 +61,13 @@ impl AliveBitSet {
AliveBitSet::from(bitset)
}
/// Returns true iff the document is still "alive". In other words, if it has not been deleted.
/// Returns true if the document is still "alive". In other words, if it has not been deleted.
#[inline]
pub fn is_alive(&self, doc: DocId) -> bool {
self.bitset.contains(doc)
}
/// Returns true iff the document has been marked as deleted.
/// Returns true if the document has been marked as deleted.
#[inline]
pub fn is_deleted(&self, doc: DocId) -> bool {
!self.is_alive(doc)

View File

@@ -221,7 +221,7 @@ impl DeleteCursor {
}
/// Advance to the next delete operation.
/// Returns true iff there is such an operation.
/// Returns true if and only if there is such an operation.
pub fn advance(&mut self) -> bool {
if self.load_block_if_required() {
self.pos += 1;

View File

@@ -322,7 +322,7 @@ impl BlockSegmentPostings {
/// Advance to the next block.
///
/// Returns false iff there was no remaining blocks.
/// Returns false if and only if there is no remaining block.
pub fn advance(&mut self) {
self.skip_reader.advance();
self.block_max_score_cache = None;

View File

@@ -35,7 +35,7 @@ where TScoreCombiner: ScoreCombiner {
.iter()
.all(|scorer| scorer.freq_reading_option() == FreqReadingOption::ReadFreq)
{
// Block wand is only available iff we read frequencies.
// Block wand is only available if we read frequencies.
return SpecializedScorer::TermUnion(scorers);
} else {
return SpecializedScorer::Other(Box::new(Union::<_, TScoreCombiner>::from(

View File

@@ -54,7 +54,7 @@ pub struct PhraseScorer<TPostings: Postings> {
scoring_enabled: bool,
}
/// Returns true iff the two sorted array contain a common element
/// Returns true if and only if the two sorted arrays contain a common element
fn intersection_exists(left: &[u32], right: &[u32]) -> bool {
let mut left_i = 0;
let mut right_i = 0;

View File

@@ -75,7 +75,7 @@ pub enum QueryParserError {
/// Recursively remove empty clause from the AST
///
/// Returns `None` iff the `logical_ast` ended up being empty.
/// Returns `None` if and only if the `logical_ast` ended up being empty.
fn trim_ast(logical_ast: LogicalAst) -> Option<LogicalAst> {
match logical_ast {
LogicalAst::Clause(children) => {

View File

@@ -14,9 +14,9 @@ pub struct BytesOptions {
}
/// For backward compability we add an intermediary to interpret the
/// lack of fieldnorms attribute as "true" iff indexed.
/// lack of fieldnorms attribute as "true" if and only if indexed.
///
/// (Downstream, for the moment, this attribute is not used anyway if not indexed...)
/// (Downstream, for the moment, this attribute is not used if not indexed...)
/// Note that: newly serialized NumericOptions will include the new attribute.
#[derive(Deserialize)]
struct BytesOptionsDeser {
@@ -39,22 +39,22 @@ impl From<BytesOptionsDeser> for BytesOptions {
}
impl BytesOptions {
/// Returns true iff the value is indexed.
/// Returns true if the value is indexed.
pub fn is_indexed(&self) -> bool {
self.indexed
}
/// Returns true iff the value is normed.
/// Returns true if and only if the value is normed.
pub fn fieldnorms(&self) -> bool {
self.fieldnorms
}
/// Returns true iff the value is a fast field.
/// Returns true if the value is a fast field.
pub fn is_fast(&self) -> bool {
self.fast
}
/// Returns true iff the value is stored.
/// Returns true if the value is stored.
pub fn is_stored(&self) -> bool {
self.stored
}

View File

@@ -71,7 +71,7 @@ impl Document {
self.field_values.len()
}
/// Returns true iff the document contains no fields.
/// Returns true if the document contains no fields.
pub fn is_empty(&self) -> bool {
self.field_values.is_empty()
}

View File

@@ -49,7 +49,7 @@ impl Facet {
Facet("".to_string())
}
/// Returns true iff the facet is the root facet `/`.
/// Returns true if the facet is the root facet `/`.
pub fn is_root(&self) -> bool {
self.encoded_str().is_empty()
}

View File

@@ -13,7 +13,7 @@ pub struct FacetOptions {
}
impl FacetOptions {
/// Returns true iff the value is stored.
/// Returns true if the value is stored.
pub fn is_stored(&self) -> bool {
self.stored
}

View File

@@ -79,19 +79,19 @@ impl FieldEntry {
&self.field_type
}
/// Returns true iff the field is indexed.
/// Returns true if the field is indexed.
///
/// An indexed field is searchable.
pub fn is_indexed(&self) -> bool {
self.field_type.is_indexed()
}
/// Returns true iff the field is normed
/// Returns true if the field is normed
pub fn has_fieldnorms(&self) -> bool {
self.field_type.has_fieldnorms()
}
/// Returns true iff the field is a int (signed or unsigned) fast field
/// Returns true if the field is a int (signed or unsigned) fast field
pub fn is_fast(&self) -> bool {
match self.field_type {
FieldType::U64(ref options)
@@ -102,7 +102,7 @@ impl FieldEntry {
}
}
/// Returns true iff the field is stored
/// Returns true if the field is stored
pub fn is_stored(&self) -> bool {
match self.field_type {
FieldType::U64(ref options)

View File

@@ -148,7 +148,7 @@ impl FieldType {
}
}
/// returns true iff the field is indexed.
/// returns true if the field is indexed.
pub fn is_indexed(&self) -> bool {
match *self {
FieldType::Str(ref text_options) => text_options.get_indexing_options().is_some(),
@@ -183,7 +183,7 @@ impl FieldType {
}
}
/// returns true iff the field is normed.
/// returns true if the field is normed.
pub fn has_fieldnorms(&self) -> bool {
match *self {
FieldType::Str(ref text_options) => text_options

View File

@@ -30,7 +30,7 @@ pub enum IndexRecordOption {
}
impl IndexRecordOption {
/// Returns true iff this option includes encoding
/// Returns true if this option includes encoding
/// term frequencies.
pub fn has_freq(self) -> bool {
match self {
@@ -39,7 +39,7 @@ impl IndexRecordOption {
}
}
/// Returns true iff this option include encoding
/// Returns true if this option include encoding
/// term positions.
pub fn has_positions(self) -> bool {
match self {

View File

@@ -16,7 +16,7 @@ pub struct JsonObjectOptions {
}
impl JsonObjectOptions {
/// Returns `true` iff the json object should be stored.
/// Returns `true` if the json object should be stored.
pub fn is_stored(&self) -> bool {
self.stored
}

View File

@@ -33,7 +33,7 @@ pub struct NumericOptions {
}
/// For backward compability we add an intermediary to interpret the
/// lack of fieldnorms attribute as "true" iff indexed.
/// lack of fieldnorms attribute as "true" if and only if indexed.
///
/// (Downstream, for the moment, this attribute is not used anyway if not indexed...)
/// Note that: newly serialized NumericOptions will include the new attribute.

View File

@@ -19,7 +19,7 @@ impl TextOptions {
self.indexing.as_ref()
}
/// Returns true iff the text is to be stored.
/// Returns true if the text is to be stored.
pub fn is_stored(&self) -> bool {
self.stored
}
@@ -83,7 +83,7 @@ impl TextFieldIndexing {
self
}
/// Returns true iff fieldnorms are stored.
/// Returns true if and only if fieldnorms are stored.
pub fn fieldnorms(&self) -> bool {
self.fieldnorms
}

View File

@@ -143,12 +143,13 @@ impl TermDictionary {
Ok(self.fst_index.get(key))
}
/// Returns the term associated to a given term ordinal.
/// Stores the term associated to a given term ordinal in
/// a `bytes` buffer.
///
/// Term ordinals are defined as the position of the term in
/// the sorted list of terms.
///
/// Returns true iff the term has been found.
/// Returns true if and only if the term has been found.
///
/// Regardless of whether the term is found or not,
/// the buffer may be modified.

View File

@@ -98,7 +98,7 @@ impl<'a> TermMerger<'a> {
/// Returns the current term.
///
/// This method may be called
/// iff advance() has been called before
/// if and only if advance() has been called before
/// and "true" was returned.
pub fn key(&self) -> &[u8] {
self.current_streamers[0].streamer.key()
@@ -108,7 +108,7 @@ impl<'a> TermMerger<'a> {
/// that include the current term.
///
/// This method may be called
/// iff advance() has been called before
/// if and only if advance() has been called before
/// and "true" was returned.
pub fn current_segment_ords_and_term_infos<'b: 'a>(
&'b self,

View File

@@ -171,7 +171,7 @@ impl TermDictionary {
/// Term ordinals are defined as the position of the term in
/// the sorted list of terms.
///
/// Returns true iff the term has been found.
/// Returns true if and only if the term has been found.
///
/// Regardless of whether the term is found or not,
/// the buffer may be modified.