.jshintrc
author Georges Racinet on incendie.racinet.fr <georges@racinet.fr>
Tue, 17 Oct 2023 22:42:40 +0200
changeset 51224 43241f31cf5b
parent 35162 bdd2e18b54c5
permissions -rw-r--r--
rust-index: find_gca_candidates bit sets genericization This allows to use arbitratry size of inputs in `find_gca_candidates()`. We're genericizing so that the common case of up to 63 inputs can be treated with the efficient implementation backed by `u64`. Some complications with the borrow checker came, because arbitrary sized bit sets will not be `Copy`, hence mutating them keeps a mut ref on the `seen` vector. This is solved by some cloning, most of which can be avoided, preferably in a follow-up after proof that this works (hence after exposition to Python layer). As far as performance is concerned, calling `clone()` on a `Copy` object (good case when number of revs is less than 64) should end up just doing a copy, according to this excerpt of the `Clone` trait documentation: Types that are Copy should have a trivial implementation of Clone. More formally: if T: Copy, x: T, and y: &T, then let x = y.clone(); is equivalent to let x = *y;. Manual implementations should be careful to uphold this invariant; however, unsafe code must not rely on it to ensure memory safety. We kept the general structure, hence why there are some double negations. This also could be made nicer in a follow-up. The `NonStaticPoisonableBitSet` is included to ensure that the `PoisonableBitSet` trait is general enough (had to correct `vec_of_empty()` for instance). Moving the genericization one level to encompass the `seen` vector and not its elements would be better for performance, if worth it.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35162
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
{
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
    // Enforcing
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
    "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
    "forin"         : true,     // true: Require filtering for..in loops with obj.hasOwnProperty()
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
    "freeze"        : true,     // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
    "nonbsp"        : true,     // true: Prohibit "non-breaking whitespace" characters.
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
    "undef"         : true,     // true: Require all non-global variables to be declared (prevents global leaks)
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
    // Environments
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
    "browser"       : true      // Web Browser (window, document, etc)
bdd2e18b54c5 hgweb: add .jshintrc with some basic rules
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
}