RS.CLIPPY.NON_OCTAL_UNIX_PERMISSIONS
Use of non-octal value to set unix file permissions, which will be translated into octal
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: non_octal_unix_permissions. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for non-octal values used to set Unix file permissions.
Why is this bad?
They will be converted into octal, creating potentially unintended file permissions.
Example
use std::fs::OpenOptions;
use std::os::unix::fs::OpenOptionsExt;
let mut options = OpenOptions::new();
options.mode(644);
Use instead:
use std::fs::OpenOptions;
use std::os::unix::fs::OpenOptionsExt;
let mut options = OpenOptions::new();
options.mode(0o644);