Skip to content

Enable clippy during tests #153

Closed
Closed

Description

@aaronmondal

A draft of this is at #152.

My current migration plan:

Add remaining fixes separately:

Finally:

Additional issues/questions I encountered so far:

  • Clippy doesn't like the highest_priority_action_first and equal_priority_earliest_first tests in cas/scheduler/tests/action_messages_test.rs. I'm not sure what these tests are trying to test. Is this about Ord? Would testing something like assert!(first_action < current_action) or similar also work?
  • Removes needless overoptimization of strings for DigestInfo #174 The GetFinishedResult in cas/worker/tests/utils/mock_running_actions_manager.rs pointed out that the largest GetFinishedResult variant contains at least 496 bytes. It's talking about ActionResult here. I'd expect this to be fairly large but should it really be this large at all times?
  • We "hold a RefCell reference across an await point" in cas/store/tests/filesystem_store_test.rs L731. Seems like something is wrong there.

Activity

  1. self-assigned this
    on Jul 9, 2023
  2. allada commented on Jul 12, 2023

    @allada
    Contributor

    Try and hold off on the scheduler stuff until @chrisstaite-menlo has landed his changes.

  3. allada commented on Jul 12, 2023

    @allada
    Contributor

    We "hold a RefCell reference across an await point" in cas/store/tests/filesystem_store_test.rs L731. Seems like something is wrong there.

    I ended up disabling this warning. I tried to turn it into a mutex but it didn't help, it just gave another clippy error. In this case the reason it's complaining is because we "might" deadlock because we are calling an async function while we hold a lock (for mutex). The RefCell is complaining because technically multiple people can mutate the object in random places in the code without a clear code path of where all has mutable references. Granted this would all happen on the same thread (because Rc is not Send). All it's trying to do is make sure that the promise is still pending and the way it does this is by wrapping the future in another future temporary and calling pretty much calling await on it... This allows the outer future to get a context and then it calls .poll() on the inner future, and returns the Polling results. In this case it's a test and I don't see a direct way to fix this without turning off the warning.

  4. allada commented on Jul 12, 2023

    @allada
    Contributor

    The GetFinishedResult in cas/worker/tests/utils/mock_running_actions_manager.rs pointed out that the largest GetFinishedResult variant contains at least 496 bytes. It's talking about ActionResult here. I'd expect this to be fairly large but should it really be this large at all times?

    Hmmm, I can do some simple math on this:

    Sums to 460, so yeah, my math is probably off a little because of DigestInfo's LazyTransform.

  5. allada commented on Jul 12, 2023

    @allada
    Contributor

    FYI #174 almost certainly is going to trigger many places where we call .clone() but it's trivial copyable now, so we'll need to re-run clippy on many directories that were already fixed.

  6. aaronmondal commented on Jul 15, 2023

    @aaronmondal
    ContributorAuthor

    Closed by #182 Onwards to pedantic 🤣 🎉 🥳 🎈 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions