mirror of
https://github.com/instructkr/claude-code.git
synced 2026-04-05 18:58:48 +03:00
fix: suppress dead_code warnings for unused file_ops functions
This commit is contained in:
@@ -28,6 +28,7 @@ fn is_binary_file(path: &Path) -> io::Result<bool> {
|
|||||||
/// Validate that a resolved path stays within the given workspace root.
|
/// Validate that a resolved path stays within the given workspace root.
|
||||||
/// Returns the canonical path on success, or an error if the path escapes
|
/// Returns the canonical path on success, or an error if the path escapes
|
||||||
/// the workspace boundary (e.g. via `../` traversal or symlink).
|
/// the workspace boundary (e.g. via `../` traversal or symlink).
|
||||||
|
#[allow(dead_code)]
|
||||||
fn validate_workspace_boundary(resolved: &Path, workspace_root: &Path) -> io::Result<()> {
|
fn validate_workspace_boundary(resolved: &Path, workspace_root: &Path) -> io::Result<()> {
|
||||||
if !resolved.starts_with(workspace_root) {
|
if !resolved.starts_with(workspace_root) {
|
||||||
return Err(io::Error::new(
|
return Err(io::Error::new(
|
||||||
@@ -557,6 +558,7 @@ fn normalize_path_allow_missing(path: &str) -> io::Result<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Read a file with workspace boundary enforcement.
|
/// Read a file with workspace boundary enforcement.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn read_file_in_workspace(
|
pub fn read_file_in_workspace(
|
||||||
path: &str,
|
path: &str,
|
||||||
offset: Option<usize>,
|
offset: Option<usize>,
|
||||||
@@ -572,6 +574,7 @@ pub fn read_file_in_workspace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Write a file with workspace boundary enforcement.
|
/// Write a file with workspace boundary enforcement.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn write_file_in_workspace(
|
pub fn write_file_in_workspace(
|
||||||
path: &str,
|
path: &str,
|
||||||
content: &str,
|
content: &str,
|
||||||
@@ -586,6 +589,7 @@ pub fn write_file_in_workspace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Edit a file with workspace boundary enforcement.
|
/// Edit a file with workspace boundary enforcement.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn edit_file_in_workspace(
|
pub fn edit_file_in_workspace(
|
||||||
path: &str,
|
path: &str,
|
||||||
old_string: &str,
|
old_string: &str,
|
||||||
@@ -602,6 +606,7 @@ pub fn edit_file_in_workspace(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check whether a path is a symlink that resolves outside the workspace.
|
/// Check whether a path is a symlink that resolves outside the workspace.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn is_symlink_escape(path: &Path, workspace_root: &Path) -> io::Result<bool> {
|
pub fn is_symlink_escape(path: &Path, workspace_root: &Path) -> io::Result<bool> {
|
||||||
let metadata = fs::symlink_metadata(path)?;
|
let metadata = fs::symlink_metadata(path)?;
|
||||||
if !metadata.is_symlink() {
|
if !metadata.is_symlink() {
|
||||||
|
|||||||
Reference in New Issue
Block a user