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

Remove redundant check in symlink_hard_link test #130067

Merged
merged 1 commit into from
Sep 9, 2024
Merged
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
18 changes: 0 additions & 18 deletions library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use rand::RngCore;

#[cfg(target_os = "macos")]
use crate::ffi::{c_char, c_int};
use crate::fs::{self, File, FileTimes, OpenOptions};
use crate::io::prelude::*;
use crate::io::{BorrowedBuf, ErrorKind, SeekFrom};
Expand All @@ -16,8 +14,6 @@ use crate::os::unix::fs::symlink as junction_point;
use crate::os::windows::fs::{junction_point, symlink_dir, symlink_file, OpenOptionsExt};
use crate::path::Path;
use crate::sync::Arc;
#[cfg(target_os = "macos")]
use crate::sys::weak::weak;
use crate::sys_common::io::test::{tmpdir, TempDir};
use crate::time::{Duration, Instant, SystemTime};
use crate::{env, str, thread};
Expand Down Expand Up @@ -80,17 +76,6 @@ pub fn got_symlink_permission(tmpdir: &TempDir) -> bool {
}
}

#[cfg(target_os = "macos")]
fn able_to_not_follow_symlinks_while_hard_linking() -> bool {
weak!(fn linkat(c_int, *const c_char, c_int, *const c_char, c_int) -> c_int);
linkat.get().is_some()
}

#[cfg(not(target_os = "macos"))]
fn able_to_not_follow_symlinks_while_hard_linking() -> bool {
return true;
}

#[test]
fn file_test_io_smoke_test() {
let message = "it's alright. have a good time";
Expand Down Expand Up @@ -1456,9 +1441,6 @@ fn symlink_hard_link() {
if !got_symlink_permission(&tmpdir) {
return;
};
if !able_to_not_follow_symlinks_while_hard_linking() {
return;
}

// Create "file", a file.
check!(fs::File::create(tmpdir.join("file")));
Expand Down
Loading