Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
R
rust-rocksdb
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • fangzongwu
  • rust-rocksdb
  • Repository

Switch branch/tag
  • rust-rocksdb
  • src
  • comparator.rs
Find file
BlameHistoryPermalink
  • Brian Anderson's avatar
    Fix clippy warnings etc. (#393) · 970a27c2
    Brian Anderson authored Nov 28, 2019
    * Fix various unsafe declarations
    
    As reported by clippy. These are all cases where a pointer argument is
    dereferenced by a declared safe function. The functions are changed to be unsafe
    functions. Though some of these functions are declared pub, they all seem to be
    related to internal binding matters and appear to be written correctly, just
    declared incorrectly, so there shouldn't be any external impact for callers
    that aren't using the crocksdb API directly.
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Fix some clippy style lints
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Fix mutability of crocksdb_load_latest_options errptr
    
    This value can be mutated on the C side. Caught by clippy.
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Cleanup some unit-return functions
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Disable a clippy lint
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * make a transmute more typesafe
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Elide a lifetime
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Remove unnecessary unsafe blocks
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Use repr(C) structs of c_void for opaque types.
    
    These represent opaque RocksDB types. They are used behind pointers, but are
    also wrapped in other types in the higher-level bindings.
    
    These use the strategy for opaque C types described in the nomicon [1]:
    but with the exception that they contain c_void instead of [u8; 0], thus
    making them uninstantiable sized types instead of ZSTs.
    
    The c_void documentation publicly recommends using the ZST pattern from the
    nomicon, but in private documentation [2] warns about UB from dereferencing
    pointers to uninhabited types, which these bindings do.
    
    Additionally, these bindings wrap some these types directly (not through
    pointers) and it's impossible to repr(transparent) a ZST, without which the
    unsafe casts within are dubious.
    
    [1]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
    [2]: https://doc.rust-lang.org/nightly/src/core/ffi.rs.html#28Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Apply repr(transparent) to various unsafe-cast wrappers
    
    These are wrappers of opaque FFI types, and pointers are being unsafely cast
    between the two. repr(transparent) is probably needed to make this well-defined.
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Replace mem::transmute with pointer casts
    
    Slightly more typesafe, and more explicit about what's being cast.
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Replace more mem::transmute with casts
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Remove a no-op mem::transmute
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Remove is_power_of_two
    
    std contains a branchless bitmagic version of this function
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Add clippy makefile target
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Add clippy to CI
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Fix types in memcpy
    
    This code is copying from c_void pointers when it should be copying
    from byte pointers.
    
    Fortunately c_void and u8 have the same size, but I don't know if that is
    guaranteed.
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Update src/rocksdb.rs
    Co-Authored-By: 's avatarkennytm <kennytm@gmail.com>
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Install clippy on travis
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Adjust clippy lints for CI toolchain
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * Make a typesafe cast
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    
    * rustfmt
    Signed-off-by: 's avatarBrian Anderson <andersrb@gmail.com>
    970a27c2
comparator.rs 1.58 KB
EditWeb IDE

Replace comparator.rs

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.