Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some doc test error #290

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions monoio/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pub use metadata::{metadata, symlink_metadata, Metadata};

#[cfg(unix)]
mod file_type;
#[cfg(target_os = "linux")]
#[cfg(unix)]
pub use file_type::FileType;

#[cfg(unix)]
mod permissions;
#[cfg(target_os = "linux")]
#[cfg(unix)]
pub use permissions::Permissions;

use crate::buf::IoBuf;
Expand Down Expand Up @@ -87,11 +87,9 @@ pub async fn write<P: AsRef<Path>, C: IoBuf>(path: P, contents: C) -> (io::Resul
/// # Examples
///
/// ```no_run
/// use monoio::fs::File;
///
/// #[monoio::main]
/// async fn main() -> std::io::Result<()> {
/// fs::remove_file("a.txt").await?;
/// monoio::fs::remove_file("a.txt").await?;
/// Ok(())
/// }
/// ```
Expand Down Expand Up @@ -120,11 +118,9 @@ pub async fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// # Examples
///
/// ```no_run
/// use monoio::fs::File;
///
/// #[monoio::main]
/// async fn main() -> std::io::Result<()> {
/// fs::remove_dir("/some/dir").await?;
/// monoio::fs::remove_dir("/some/dir").await?;
/// Ok(())
/// }
/// ```
Expand Down Expand Up @@ -153,11 +149,9 @@ pub async fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// # Examples
///
/// ```no_run
/// use monoio::fs;
///
/// #[monoio::main]
/// async fn main() -> std::io::Result<()> {
/// fs::rename("a.txt", "b.txt")?; // Rename a.txt to b.txt
/// monoio::fs::rename("a.txt", "b.txt").await?; // Rename a.txt to b.txt
/// Ok(())
/// }
/// ```
Expand Down
4 changes: 2 additions & 2 deletions monoio/tests/fs_rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ async fn mv_file_in_different_directory() {
}

#[monoio::test_all]
async fn rename_inexist_file() {
async fn rename_nonexistent_file() {
let temp_dir = tempfile::tempdir().unwrap();

let old_file_path = temp_dir.path().join("inexist.txt");
let old_file_path = temp_dir.path().join("nonexistent.txt");
let new_file_path = temp_dir.path().join("renamed.txt");

let result = monoio::fs::rename(old_file_path, new_file_path).await;
Expand Down
Loading