Skip to content

Commit 29ad871

Browse files
committed
change lint name to ipv4v6_constant_hardcode
1 parent a45c37b commit 29ad871

File tree

8 files changed

+86
-86
lines changed

8 files changed

+86
-86
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5937,7 +5937,7 @@ Released 2018-09-13
59375937
[`lint_groups_priority`]: https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
59385938
[`literal_string_with_formatting_args`]: https://rust-lang.github.io/rust-clippy/master/index.html#literal_string_with_formatting_args
59395939
[`little_endian_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#little_endian_bytes
5940-
[`localhost_hardcode`]: https://rust-lang.github.io/rust-clippy/master/index.html#localhost_hardcode
5940+
[`ipv4v6_constant_hardcode`]: https://rust-lang.github.io/rust-clippy/master/index.html#ipv4v6_constant_hardcode
59415941
[`logic_bug`]: https://rust-lang.github.io/rust-clippy/master/index.html#logic_bug
59425942
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
59435943
[`macro_metavars_in_unsafe`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_metavars_in_unsafe

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
397397
crate::methods::ITER_SKIP_ZERO_INFO,
398398
crate::methods::ITER_WITH_DRAIN_INFO,
399399
crate::methods::JOIN_ABSOLUTE_PATHS_INFO,
400-
crate::methods::LOCALHOST_HARDCODE_INFO,
400+
crate::methods::IPV4V6_CONSTANT_HARDCODE_INFO,
401401
crate::methods::MANUAL_CONTAINS_INFO,
402402
crate::methods::MANUAL_C_STR_LITERALS_INFO,
403403
crate::methods::MANUAL_FILTER_MAP_INFO,

clippy_lints/src/methods/localhost_hardcode.rs renamed to clippy_lints/src/methods/ipv4v6_constant_hardcode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir::{Expr, ExprKind, QPath, Ty, TyKind};
66
use rustc_lint::LateContext;
77
use rustc_span::sym;
88

9-
use super::LOCALHOST_HARDCODE;
9+
use super::IPV4V6_CONSTANT_HARDCODE;
1010

1111
static IPV4V6_CONSTANTS: &[(&[u128], &str)] = &[
1212
// Ipv4
@@ -40,7 +40,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, func: &Expr<'_>, args
4040

4141
span_lint_and_sugg(
4242
cx,
43-
LOCALHOST_HARDCODE,
43+
IPV4V6_CONSTANT_HARDCODE,
4444
expr.span,
4545
format!("use `{sugg_snip}` instead"),
4646
"try",

clippy_lints/src/methods/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ mod inefficient_to_string;
3737
mod inspect_for_each;
3838
mod into_iter_on_ref;
3939
mod io_other_error;
40+
mod ipv4v6_constant_hardcode;
4041
mod is_digit_ascii_radix;
4142
mod is_empty;
4243
mod iter_cloned_collect;
@@ -54,7 +55,6 @@ mod iter_skip_zero;
5455
mod iter_with_drain;
5556
mod iterator_step_by_zero;
5657
mod join_absolute_paths;
57-
mod localhost_hardcode;
5858
mod manual_c_str_literals;
5959
mod manual_contains;
6060
mod manual_inspect;
@@ -4548,7 +4548,7 @@ declare_clippy_lint! {
45484548
/// let addr = Ipv4Addr::LOCALHOST;
45494549
/// ```
45504550
#[clippy::version = "1.89.0"]
4551-
pub LOCALHOST_HARDCODE,
4551+
pub IPV4V6_CONSTANT_HARDCODE,
45524552
style,
45534553
"hardcoded localhost IP address"
45544554
}
@@ -4731,7 +4731,7 @@ impl_lint_pass!(Methods => [
47314731
MANUAL_CONTAINS,
47324732
IO_OTHER_ERROR,
47334733
SWAP_WITH_TEMPORARY,
4734-
LOCALHOST_HARDCODE,
4734+
IPV4V6_CONSTANT_HARDCODE,
47354735
]);
47364736

47374737
/// Extracts a method call name, args, and `Span` of the method name.
@@ -4764,7 +4764,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
47644764
useless_nonzero_new_unchecked::check(cx, expr, func, args, self.msrv);
47654765
io_other_error::check(cx, expr, func, args, self.msrv);
47664766
swap_with_temporary::check(cx, expr, func, args);
4767-
localhost_hardcode::check(cx, expr, func, args);
4767+
ipv4v6_constant_hardcode::check(cx, expr, func, args);
47684768
},
47694769
ExprKind::MethodCall(method_call, receiver, args, _) => {
47704770
let method_span = method_call.ident.span;

tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::await_holding_invalid_type)]
2-
#![allow(clippy::localhost_hardcode)]
2+
#![allow(clippy::ipv4v6_constant_hardcode)]
33
use std::net::Ipv4Addr;
44

55
async fn bad() -> u32 {
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
#![warn(clippy::localhost_hardcode)]
1+
#![warn(clippy::ipv4v6_constant_hardcode)]
22
#![allow(dead_code)]
33
#![allow(clippy::identity_op)]
44
#![allow(clippy::eq_op)]
55

66
fn literal_test1() {
77
use std::net::Ipv4Addr;
88
let _ = Ipv4Addr::LOCALHOST;
9-
//~^ localhost_hardcode
9+
//~^ ipv4v6_constant_hardcode
1010
let _ = Ipv4Addr::BROADCAST;
11-
//~^ localhost_hardcode
11+
//~^ ipv4v6_constant_hardcode
1212
let _ = Ipv4Addr::UNSPECIFIED;
13-
//~^ localhost_hardcode
13+
//~^ ipv4v6_constant_hardcode
1414

1515
use std::net::Ipv6Addr;
1616
let _ = Ipv6Addr::LOCALHOST;
17-
//~^ localhost_hardcode
17+
//~^ ipv4v6_constant_hardcode
1818
let _ = Ipv6Addr::UNSPECIFIED;
19-
//~^ localhost_hardcode
19+
//~^ ipv4v6_constant_hardcode
2020
}
2121

2222
fn literal_test2() {
2323
use std::net;
2424
let _ = net::Ipv4Addr::LOCALHOST;
25-
//~^ localhost_hardcode
25+
//~^ ipv4v6_constant_hardcode
2626
let _ = net::Ipv4Addr::BROADCAST;
27-
//~^ localhost_hardcode
27+
//~^ ipv4v6_constant_hardcode
2828
let _ = net::Ipv4Addr::UNSPECIFIED;
29-
//~^ localhost_hardcode
29+
//~^ ipv4v6_constant_hardcode
3030

3131
let _ = net::Ipv6Addr::LOCALHOST;
32-
//~^ localhost_hardcode
32+
//~^ ipv4v6_constant_hardcode
3333
let _ = net::Ipv6Addr::UNSPECIFIED;
34-
//~^ localhost_hardcode
34+
//~^ ipv4v6_constant_hardcode
3535
}
3636

3737
fn literal_test3() {
3838
let _ = std::net::Ipv4Addr::LOCALHOST;
39-
//~^ localhost_hardcode
39+
//~^ ipv4v6_constant_hardcode
4040
let _ = std::net::Ipv4Addr::BROADCAST;
41-
//~^ localhost_hardcode
41+
//~^ ipv4v6_constant_hardcode
4242
let _ = std::net::Ipv4Addr::UNSPECIFIED;
43-
//~^ localhost_hardcode
43+
//~^ ipv4v6_constant_hardcode
4444

4545
let _ = std::net::Ipv6Addr::LOCALHOST;
46-
//~^ localhost_hardcode
46+
//~^ ipv4v6_constant_hardcode
4747
let _ = std::net::Ipv6Addr::UNSPECIFIED;
48-
//~^ localhost_hardcode
48+
//~^ ipv4v6_constant_hardcode
4949
}
5050

5151
const CONST_U8_0: u8 = 0;
@@ -59,11 +59,11 @@ const CONST_U16_1: u16 = 1;
5959
fn const_test1() {
6060
use std::net::Ipv4Addr;
6161
let _ = Ipv4Addr::LOCALHOST;
62-
//~^ localhost_hardcode
62+
//~^ ipv4v6_constant_hardcode
6363
let _ = Ipv4Addr::BROADCAST;
64-
//~^ localhost_hardcode
64+
//~^ ipv4v6_constant_hardcode
6565
let _ = Ipv4Addr::UNSPECIFIED;
66-
//~^ localhost_hardcode
66+
//~^ ipv4v6_constant_hardcode
6767

6868
use std::net::Ipv6Addr;
6969
let _ = Ipv6Addr::LOCALHOST;
@@ -74,17 +74,17 @@ fn const_test1() {
7474
fn const_test2() {
7575
use std::net::Ipv4Addr;
7676
let _ = Ipv4Addr::LOCALHOST;
77-
//~^ localhost_hardcode
77+
//~^ ipv4v6_constant_hardcode
7878
let _ = Ipv4Addr::BROADCAST;
79-
//~^ localhost_hardcode
79+
//~^ ipv4v6_constant_hardcode
8080
let _ = Ipv4Addr::UNSPECIFIED;
81-
//~^ localhost_hardcode
81+
//~^ ipv4v6_constant_hardcode
8282

8383
use std::net::Ipv6Addr;
8484
let _ = Ipv6Addr::LOCALHOST;
85-
//~^ localhost_hardcode
85+
//~^ ipv4v6_constant_hardcode
8686
let _ = Ipv6Addr::LOCALHOST;
87-
//~^ localhost_hardcode
87+
//~^ ipv4v6_constant_hardcode
8888
}
8989

9090
macro_rules! ipv4_new {
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
#![warn(clippy::localhost_hardcode)]
1+
#![warn(clippy::ipv4v6_constant_hardcode)]
22
#![allow(dead_code)]
33
#![allow(clippy::identity_op)]
44
#![allow(clippy::eq_op)]
55

66
fn literal_test1() {
77
use std::net::Ipv4Addr;
88
let _ = Ipv4Addr::new(127, 0, 0, 1);
9-
//~^ localhost_hardcode
9+
//~^ ipv4v6_constant_hardcode
1010
let _ = Ipv4Addr::new(255, 255, 255, 255);
11-
//~^ localhost_hardcode
11+
//~^ ipv4v6_constant_hardcode
1212
let _ = Ipv4Addr::new(0, 0, 0, 0);
13-
//~^ localhost_hardcode
13+
//~^ ipv4v6_constant_hardcode
1414

1515
use std::net::Ipv6Addr;
1616
let _ = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
17-
//~^ localhost_hardcode
17+
//~^ ipv4v6_constant_hardcode
1818
let _ = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0);
19-
//~^ localhost_hardcode
19+
//~^ ipv4v6_constant_hardcode
2020
}
2121

2222
fn literal_test2() {
2323
use std::net;
2424
let _ = net::Ipv4Addr::new(127, 0, 0, 1);
25-
//~^ localhost_hardcode
25+
//~^ ipv4v6_constant_hardcode
2626
let _ = net::Ipv4Addr::new(255, 255, 255, 255);
27-
//~^ localhost_hardcode
27+
//~^ ipv4v6_constant_hardcode
2828
let _ = net::Ipv4Addr::new(0, 0, 0, 0);
29-
//~^ localhost_hardcode
29+
//~^ ipv4v6_constant_hardcode
3030

3131
let _ = net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
32-
//~^ localhost_hardcode
32+
//~^ ipv4v6_constant_hardcode
3333
let _ = net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0);
34-
//~^ localhost_hardcode
34+
//~^ ipv4v6_constant_hardcode
3535
}
3636

3737
fn literal_test3() {
3838
let _ = std::net::Ipv4Addr::new(127, 0, 0, 1);
39-
//~^ localhost_hardcode
39+
//~^ ipv4v6_constant_hardcode
4040
let _ = std::net::Ipv4Addr::new(255, 255, 255, 255);
41-
//~^ localhost_hardcode
41+
//~^ ipv4v6_constant_hardcode
4242
let _ = std::net::Ipv4Addr::new(0, 0, 0, 0);
43-
//~^ localhost_hardcode
43+
//~^ ipv4v6_constant_hardcode
4444

4545
let _ = std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
46-
//~^ localhost_hardcode
46+
//~^ ipv4v6_constant_hardcode
4747
let _ = std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0);
48-
//~^ localhost_hardcode
48+
//~^ ipv4v6_constant_hardcode
4949
}
5050

5151
const CONST_U8_0: u8 = 0;
@@ -59,15 +59,15 @@ const CONST_U16_1: u16 = 1;
5959
fn const_test1() {
6060
use std::net::Ipv4Addr;
6161
let _ = Ipv4Addr::new(CONST_U8_127, CONST_U8_0, CONST_U8_0, CONST_U8_1);
62-
//~^ localhost_hardcode
62+
//~^ ipv4v6_constant_hardcode
6363
let _ = Ipv4Addr::new(CONST_U8_255, CONST_U8_255, CONST_U8_255, CONST_U8_255);
64-
//~^ localhost_hardcode
64+
//~^ ipv4v6_constant_hardcode
6565
let _ = Ipv4Addr::new(CONST_U8_0, CONST_U8_0, CONST_U8_0, CONST_U8_0);
66-
//~^ localhost_hardcode
66+
//~^ ipv4v6_constant_hardcode
6767

6868
use std::net::Ipv6Addr;
6969
let _ = Ipv6Addr::new(
70-
//~^ localhost_hardcode
70+
//~^ ipv4v6_constant_hardcode
7171
CONST_U16_0,
7272
CONST_U16_0,
7373
CONST_U16_0,
@@ -79,7 +79,7 @@ fn const_test1() {
7979
);
8080

8181
let _ = Ipv6Addr::new(
82-
//~^ localhost_hardcode
82+
//~^ ipv4v6_constant_hardcode
8383
CONST_U16_0,
8484
CONST_U16_0,
8585
CONST_U16_0,
@@ -94,17 +94,17 @@ fn const_test1() {
9494
fn const_test2() {
9595
use std::net::Ipv4Addr;
9696
let _ = Ipv4Addr::new(126 + 1, 0, 0, 1);
97-
//~^ localhost_hardcode
97+
//~^ ipv4v6_constant_hardcode
9898
let _ = Ipv4Addr::new(254 + CONST_U8_1, 255, { 255 - CONST_U8_0 }, CONST_U8_255);
99-
//~^ localhost_hardcode
99+
//~^ ipv4v6_constant_hardcode
100100
let _ = Ipv4Addr::new(0, CONST_U8_255 - 255, 0, { 1 + 0 - 1 });
101-
//~^ localhost_hardcode
101+
//~^ ipv4v6_constant_hardcode
102102

103103
use std::net::Ipv6Addr;
104104
let _ = Ipv6Addr::new(0 + CONST_U16_0, 0, 0, 0, 0, 0, 0, 1);
105-
//~^ localhost_hardcode
105+
//~^ ipv4v6_constant_hardcode
106106
let _ = Ipv6Addr::new(0 + 0, 0, 0, 0, 0, { 2 - 1 - CONST_U16_1 }, 0, 1);
107-
//~^ localhost_hardcode
107+
//~^ ipv4v6_constant_hardcode
108108
}
109109

110110
macro_rules! ipv4_new {

0 commit comments

Comments
 (0)