Skip to content

Clippy cleanup: dangerous_implicit_autorefs #2635

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

Merged
merged 2 commits into from
May 3, 2025
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
14 changes: 6 additions & 8 deletions examples/getifaddrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() {
.address
.as_ref()
.and_then(SockaddrStorage::family)
.map(|af| format!("{:?}", af))
.map(|af| format!("{af:?}"))
.unwrap_or("".to_owned());
match (
&addr.address,
Expand All @@ -39,16 +39,14 @@ fn main() {
&addr.destination,
) {
(Some(a), Some(nm), Some(b), None) => {
println!("\t{} {} netmask {} broadcast {}", family, a, nm, b)
println!("\t{family} {a} netmask {nm} broadcast {b}")
}
(Some(a), Some(nm), None, None) => {
println!("\t{} {} netmask {}", family, a, nm)
println!("\t{family} {a} netmask {nm}")
}
(Some(a), None, None, None) => println!("\t{} {}", family, a),
(Some(a), None, None, Some(d)) => {
println!("\t{} {} -> {}", family, a, d)
}
x => todo!("{:?}", x),
(Some(a), None, None, None) => println!("\t{family} {a}"),
(Some(a), None, None, Some(d)) => println!("\t{family} {a} -> {d}"),
x => todo!("{x:?}"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2428,7 +2428,7 @@ mod tests {
let addr = UnixAddr::new_abstract(name.as_bytes()).unwrap();

let sun_path1 =
unsafe { &(*addr.as_ptr()).sun_path[..addr.path_len()] };
unsafe { &(&(*addr.as_ptr()).sun_path)[..addr.path_len()] };
let sun_path2 = [
0, 110, 105, 120, 0, 97, 98, 115, 116, 114, 97, 99, 116, 0,
116, 101, 115, 116,
Expand Down
2 changes: 1 addition & 1 deletion test/sys/test_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub fn test_path_to_sock_addr() {

let expect: &[c_char] =
unsafe { slice::from_raw_parts(path.as_ptr().cast(), path.len()) };
assert_eq!(unsafe { &(*addr.as_ptr()).sun_path[..8] }, expect);
assert_eq!(unsafe { &(&(*addr.as_ptr()).sun_path)[..8] }, expect);

assert_eq!(addr.path(), Some(actual));
}
Expand Down
6 changes: 1 addition & 5 deletions test/sys/test_sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,7 @@ fn test_tcp_congestion() {
let val = getsockopt(&fd, sockopt::TcpCongestion).unwrap();
let bytes = val.as_os_str().as_bytes();
for b in bytes.iter() {
assert_ne!(
*b, 0,
"OsString should contain no embedded NULs: {:?}",
val
);
assert_ne!(*b, 0, "OsString should contain no embedded NULs: {val:?}");
}
setsockopt(&fd, sockopt::TcpCongestion, &val).unwrap();

Expand Down
Loading