Skip to content

into_persistent(_if) documentation confusion #90

Closed
@ericcornelissen

Description

@ericcornelissen

The documentation for .into_persistent (and .into_persistent_if) suggest you can delete a persisted TempDir by calling .close on it.

/// ```no_run
/// use assert_fs::fixture::TempDir;
///
/// let tmp_dir = TempDir::new()
/// .unwrap()
/// .into_persistent();
///
/// // Ensure deletion happens.
/// tmp_dir.close().unwrap();
/// ```

However, the implementation of .close explicitly doesn't do anything when the TempDir has been persisted.

Inner::Persisted(_) => (),

So, either

  1. the documentation example should be updated to clarify a persisted TempDir can't be deleted, or
  2. the implementation of .close should be updated to remove persisted TempDir`.

Some background

I ran into this while trying to work around #51 by trying to persist-by-default and close/delete on success.

Metadata

Metadata

Assignees

No one assigned

    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