]> git.lizzy.rs Git - rust.git/commitdiff
Add a comment to `parse_bool`.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 23 Mar 2020 00:21:27 +0000 (11:21 +1100)
committerNicholas Nethercote <nnethercote@mozilla.com>
Tue, 24 Mar 2020 01:07:26 +0000 (12:07 +1100)
It's behaviour can be surprising.

src/librustc_session/options.rs

index a1ecf4e8528beff31ca17171251a398c3e366498..9fd7b7e2e9beb797ee38607c2e10ddd84e15c734 100644 (file)
@@ -299,6 +299,9 @@ pub fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool {
             }
         )*
 
+        /// Set a flag to true. Note that it cannot set the flag to false, so
+        /// using this parser in combination with a flag that defaults to true
+        /// is useless; the flag will always be true.
         fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool {
             match v {
                 Some(..) => false,