From dad8cd19d332e482e0c494600db5da596240f572 Mon Sep 17 00:00:00 2001 From: Esption Date: Wed, 8 Jul 2015 21:17:13 -0500 Subject: [PATCH] 'iff' for docs to 'if and only if' --- src/libbacktrace/aclocal.m4 | 2 +- src/libbacktrace/hashtab.h | 2 +- src/libbacktrace/ltmain.sh | 10 +++++----- src/libcollections/vec_deque.rs | 2 +- src/libcore/num/mod.rs | 2 +- src/libcore/str/pattern.rs | 2 +- src/librand/distributions/gamma.rs | 2 +- src/librustc/middle/ty.rs | 6 +++--- src/librustc/util/common.rs | 4 ++-- src/librustc_borrowck/borrowck/README.md | 2 +- src/librustc_privacy/lib.rs | 4 ++-- src/librustc_typeck/variance.rs | 2 +- src/libstd/net/parser.rs | 2 +- src/libsyntax/ext/tt/macro_parser.rs | 2 +- .../regions-variance-contravariant-use-covariant.rs | 2 +- src/test/run-pass/deriving-cmp-shortcircuit.rs | 2 +- .../regions-variance-covariant-use-covariant.rs | 2 +- 17 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/libbacktrace/aclocal.m4 b/src/libbacktrace/aclocal.m4 index f318083ba93..42214c2233a 100644 --- a/src/libbacktrace/aclocal.m4 +++ b/src/libbacktrace/aclocal.m4 @@ -88,7 +88,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# if we strip the leading $srcdir from $ac_aux_dir. That would be: +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" diff --git a/src/libbacktrace/hashtab.h b/src/libbacktrace/hashtab.h index e641d67abb0..3736622e677 100644 --- a/src/libbacktrace/hashtab.h +++ b/src/libbacktrace/hashtab.h @@ -69,7 +69,7 @@ typedef void (*htab_del) (void *); typedef int (*htab_trav) (void **, void *); /* Memory-allocation function, with the same functionality as calloc(). - If it returns NULL, the hash table implementation will pass an error + Iff it returns NULL, the hash table implementation will pass an error code back to the user, so if your code doesn't handle errors, best if you use xcalloc instead. */ typedef void *(*htab_alloc) (size_t, size_t); diff --git a/src/libbacktrace/ltmain.sh b/src/libbacktrace/ltmain.sh index e7c5b6fb8b6..84f5be9249e 100644 --- a/src/libbacktrace/ltmain.sh +++ b/src/libbacktrace/ltmain.sh @@ -1059,7 +1059,7 @@ $opt_help || { # func_lalib_p file -# True if FILE is a libtool `.la' library or `.lo' object file. +# True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () @@ -1070,7 +1070,7 @@ func_lalib_p () } # func_lalib_unsafe_p file -# True if FILE is a libtool `.la' library or `.lo' object file. +# True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. @@ -1093,7 +1093,7 @@ func_lalib_unsafe_p () } # func_ltwrapper_script_p file -# True if FILE is a libtool wrapper script +# True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () @@ -1102,7 +1102,7 @@ func_ltwrapper_script_p () } # func_ltwrapper_executable_p file -# True if FILE is a libtool wrapper executable +# True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () @@ -1130,7 +1130,7 @@ func_ltwrapper_scriptname () } # func_ltwrapper_p file -# True if FILE is a libtool wrapper script or wrapper executable +# True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 132a796d567..117b3544f02 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -108,7 +108,7 @@ impl VecDeque { ptr::write(self.ptr.offset(off as isize), t); } - /// Returns true if the buffer is at capacity + /// Returns true if and only if the buffer is at capacity #[inline] fn is_full(&self) -> bool { self.cap - self.len() == 1 } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index f7dd739f268..3fd3d4a42b2 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1126,7 +1126,7 @@ macro_rules! uint_impl { acc } - /// Returns `true` if `self == 2^k` for some `k`. + /// Returns `true` if and only if `self == 2^k` for some `k`. #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_power_of_two(self) -> bool { diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index b2b36925aab..707f7fcf2ab 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -739,7 +739,7 @@ struct TwoWaySearcher { (We also allow for the possibility of the *empty word*, a word of length zero). If x is any non-empty word, then an integer p with 0 < p <= |x| is said to be a - *period* for x if for all i with 0 <= i <= |x| - p - 1, we have x[i] == x[i+p]. + *period* for x iff for all i with 0 <= i <= |x| - p - 1, we have x[i] == x[i+p]. For example, both 1 and 2 are periods for the string "aa". As another example, the only period of the string "abcd" is 4. diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 5649c7def6f..2951563934b 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -147,7 +147,7 @@ impl IndependentSample for GammaLargeShape { loop { let StandardNormal(x) = rng.gen::(); let v_cbrt = 1.0 + self.c * x; - if v_cbrt <= 0.0 { // a^3 <= 0 if a <= 0 + if v_cbrt <= 0.0 { // a^3 <= 0 iff a <= 0 continue } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index b3d0f53a1fc..715072a12eb 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -509,9 +509,9 @@ pub struct ItemVariances { #[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Copy)] pub enum Variance { - Covariant, // T <: T if A <: B -- e.g., function return type - Invariant, // T <: T if B == A -- e.g., type of mutable cell - Contravariant, // T <: T if B <: A -- e.g., function param type + Covariant, // T <: T iff A <: B -- e.g., function return type + Invariant, // T <: T iff B == A -- e.g., type of mutable cell + Contravariant, // T <: T iff B <: A -- e.g., function param type Bivariant, // T <: T -- e.g., unused type parameter } diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index a89a42d2fca..162bf6ed9a9 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -145,7 +145,7 @@ impl<'v, P> Visitor<'v> for LoopQueryVisitor

where P: FnMut(&ast::Expr_) -> b } } -// Takes a predicate p, returns true if p is true for any subexpressions +// Takes a predicate p, returns true iff p is true for any subexpressions // of b -- skipping any inner loops (loop, while, loop_body) pub fn loop_query

(b: &ast::Block, p: P) -> bool where P: FnMut(&ast::Expr_) -> bool { let mut v = LoopQueryVisitor { @@ -168,7 +168,7 @@ impl<'v, P> Visitor<'v> for BlockQueryVisitor

where P: FnMut(&ast::Expr) -> b } } -// Takes a predicate p, returns true if p is true for any subexpressions +// Takes a predicate p, returns true iff p is true for any subexpressions // of b -- skipping any inner loops (loop, while, loop_body) pub fn block_query

(b: &ast::Block, p: P) -> bool where P: FnMut(&ast::Expr) -> bool { let mut v = BlockQueryVisitor { diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 3cde35aa84b..5cfbd59d333 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -877,7 +877,7 @@ Thus the presence of an assignment bit indicates that the assignment may have occurred. Note that assignments are only killed when the variable goes out of scope, as it is not relevant whether or not there has been a move in the meantime. Using these bits, we can declare that -an assignment to an immutable variable is legal if there is no other +an assignment to an immutable variable is legal iff there is no other assignment bit to that same variable in scope. ## Why is the design made this way? diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 7c7d45788af..d90e5a033a1 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1319,7 +1319,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> { // miscellaneous info about the impl - // `true` if this is `impl Private for ...`. + // `true` iff this is `impl Private for ...`. let not_private_trait = trait_ref.as_ref().map_or(true, // no trait counts as public trait |tr| { @@ -1328,7 +1328,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> { !is_local(did) || self.trait_is_public(did.node) }); - // `true` if this is a trait impl or at least one method is public. + // `true` iff this is a trait impl or at least one method is public. // // `impl Public { $( fn ...() {} )* }` is not visible. // diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index 996cab1cb0a..c1f9725fc81 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -216,7 +216,7 @@ //! this case, because the `Self` parameter is contravariant and `A` is //! covariant, it means that: //! -//! V_O <: V_S if +//! V_O <: V_S iff //! int <: int //! String <: Object //! diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 13bfaf0eb6c..b0fadb56f36 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -104,7 +104,7 @@ impl<'a> Parser<'a> { } } - // Return char and advance if next char is equal to requested + // Return char and advance iff next char is equal to requested fn read_given_char(&mut self, c: char) -> Option { self.read_atomically(|p| { match p.read_char() { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 065b4946160..5521c68e75c 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -321,7 +321,7 @@ pub fn parse(sess: &ParseSess, if idx >= len { // can't move out of `match`es, so: if ei.up.is_some() { - // hack: a matcher sequence is repeating if it has a + // hack: a matcher sequence is repeating iff it has a // parent (the top level is just a container) diff --git a/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs b/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs index 37bc0f41e1b..a79249ade4f 100644 --- a/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs +++ b/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs @@ -15,7 +15,7 @@ // variance inference works in the first place. // This is contravariant with respect to 'a, meaning that -// Contravariant<'long> <: Contravariant<'short> if +// Contravariant<'long> <: Contravariant<'short> iff // 'short <= 'long struct Contravariant<'a> { f: &'a isize diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index ef41c051f38..e22e4767d52 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -10,7 +10,7 @@ // check that the derived impls for the comparison traits shortcircuit // where possible, by having a type that panics when compared as the -// second element, so this passes if the instances shortcircuit. +// second element, so this passes iff the instances shortcircuit. use std::cmp::Ordering; diff --git a/src/test/run-pass/regions-variance-covariant-use-covariant.rs b/src/test/run-pass/regions-variance-covariant-use-covariant.rs index 55f845fcac8..02562781373 100644 --- a/src/test/run-pass/regions-variance-covariant-use-covariant.rs +++ b/src/test/run-pass/regions-variance-covariant-use-covariant.rs @@ -24,7 +24,7 @@ struct Covariant<'a> { } fn use_<'a>(c: Covariant<'a>) { - // OK Because Covariant<'a> <: Covariant<'static> if 'a <= 'static + // OK Because Covariant<'a> <: Covariant<'static> iff 'a <= 'static let _: Covariant<'static> = c; }