Skip to content

Commit 8e20f97

Browse files
committed
change lint name from ipv4v6_constant_hardcode to ip_constant
1 parent 3d2c5a1 commit 8e20f97

File tree

8 files changed

+88
-88
lines changed

8 files changed

+88
-88
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5888,7 +5888,7 @@ Released 2018-09-13
58885888
[`inverted_saturating_sub`]: https://rust-lang.github.io/rust-clippy/master/index.html#inverted_saturating_sub
58895889
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
58905890
[`io_other_error`]: https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error
5891-
[`ipv4v6_constant_hardcode`]: https://rust-lang.github.io/rust-clippy/master/index.html#ipv4v6_constant_hardcode
5891+
[`ip_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#ip_constant
58925892
[`is_digit_ascii_radix`]: https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix
58935893
[`items_after_statements`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
58945894
[`items_after_test_module`]: https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
379379
crate::methods::INSPECT_FOR_EACH_INFO,
380380
crate::methods::INTO_ITER_ON_REF_INFO,
381381
crate::methods::IO_OTHER_ERROR_INFO,
382-
crate::methods::IPV4V6_CONSTANT_HARDCODE_INFO,
382+
crate::methods::IP_CONSTANT_INFO,
383383
crate::methods::IS_DIGIT_ASCII_RADIX_INFO,
384384
crate::methods::ITERATOR_STEP_BY_ZERO_INFO,
385385
crate::methods::ITER_CLONED_COLLECT_INFO,

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

Lines changed: 4 additions & 4 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::IPV4V6_CONSTANT_HARDCODE;
9+
use super::IP_CONSTANT;
1010

1111
static IPV4V6_CONSTANTS: &[(&[u128], &str)] = &[
1212
// Ipv4
@@ -30,7 +30,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, func: &Expr<'_>, args
3030
&& let Some(func_def_id) = func_path.res.opt_def_id()
3131
&& (cx.tcx.is_diagnostic_item(sym::Ipv4Addr, func_def_id)
3232
|| cx.tcx.is_diagnostic_item(sym::Ipv6Addr, func_def_id))
33-
&& let Some(constant_name) = is_hardcoded_ipv4v6_constant(cx, args)
33+
&& let Some(constant_name) = is_ipv4v6_constants(cx, args)
3434
{
3535
let sugg_snip = format!(
3636
"{}::{}",
@@ -40,7 +40,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, func: &Expr<'_>, args
4040

4141
span_lint_and_sugg(
4242
cx,
43-
IPV4V6_CONSTANT_HARDCODE,
43+
IP_CONSTANT,
4444
expr.span,
4545
format!("use `{sugg_snip}` instead"),
4646
"try",
@@ -50,7 +50,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, func: &Expr<'_>, args
5050
}
5151
}
5252

53-
fn is_hardcoded_ipv4v6_constant(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<&'static str> {
53+
fn is_ipv4v6_constants(cx: &LateContext<'_>, args: &[Expr<'_>]) -> Option<&'static str> {
5454
if args.len() != 4 && args.len() != 8 {
5555
return None;
5656
}

clippy_lints/src/methods/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +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;
40+
mod ip_constant;
4141
mod is_digit_ascii_radix;
4242
mod is_empty;
4343
mod iter_cloned_collect;
@@ -4548,7 +4548,7 @@ declare_clippy_lint! {
45484548
/// let addr = Ipv4Addr::LOCALHOST;
45494549
/// ```
45504550
#[clippy::version = "1.89.0"]
4551-
pub IPV4V6_CONSTANT_HARDCODE,
4551+
pub IP_CONSTANT,
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-
IPV4V6_CONSTANT_HARDCODE,
4734+
IP_CONSTANT,
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-
ipv4v6_constant_hardcode::check(cx, expr, func, args);
4767+
ip_constant::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::ipv4v6_constant_hardcode)]
2+
#![allow(clippy::ip_constant)]
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::ipv4v6_constant_hardcode)]
1+
#![warn(clippy::ip_constant)]
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-
//~^ ipv4v6_constant_hardcode
9+
//~^ ip_constant
1010
let _ = Ipv4Addr::BROADCAST;
11-
//~^ ipv4v6_constant_hardcode
11+
//~^ ip_constant
1212
let _ = Ipv4Addr::UNSPECIFIED;
13-
//~^ ipv4v6_constant_hardcode
13+
//~^ ip_constant
1414

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

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

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

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

4545
let _ = std::net::Ipv6Addr::LOCALHOST;
46-
//~^ ipv4v6_constant_hardcode
46+
//~^ ip_constant
4747
let _ = std::net::Ipv6Addr::UNSPECIFIED;
48-
//~^ ipv4v6_constant_hardcode
48+
//~^ ip_constant
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-
//~^ ipv4v6_constant_hardcode
62+
//~^ ip_constant
6363
let _ = Ipv4Addr::BROADCAST;
64-
//~^ ipv4v6_constant_hardcode
64+
//~^ ip_constant
6565
let _ = Ipv4Addr::UNSPECIFIED;
66-
//~^ ipv4v6_constant_hardcode
66+
//~^ ip_constant
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-
//~^ ipv4v6_constant_hardcode
77+
//~^ ip_constant
7878
let _ = Ipv4Addr::BROADCAST;
79-
//~^ ipv4v6_constant_hardcode
79+
//~^ ip_constant
8080
let _ = Ipv4Addr::UNSPECIFIED;
81-
//~^ ipv4v6_constant_hardcode
81+
//~^ ip_constant
8282

8383
use std::net::Ipv6Addr;
8484
let _ = Ipv6Addr::LOCALHOST;
85-
//~^ ipv4v6_constant_hardcode
85+
//~^ ip_constant
8686
let _ = Ipv6Addr::LOCALHOST;
87-
//~^ ipv4v6_constant_hardcode
87+
//~^ ip_constant
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::ipv4v6_constant_hardcode)]
1+
#![warn(clippy::ip_constant)]
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-
//~^ ipv4v6_constant_hardcode
9+
//~^ ip_constant
1010
let _ = Ipv4Addr::new(255, 255, 255, 255);
11-
//~^ ipv4v6_constant_hardcode
11+
//~^ ip_constant
1212
let _ = Ipv4Addr::new(0, 0, 0, 0);
13-
//~^ ipv4v6_constant_hardcode
13+
//~^ ip_constant
1414

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

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

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

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

4545
let _ = std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
46-
//~^ ipv4v6_constant_hardcode
46+
//~^ ip_constant
4747
let _ = std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0);
48-
//~^ ipv4v6_constant_hardcode
48+
//~^ ip_constant
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-
//~^ ipv4v6_constant_hardcode
62+
//~^ ip_constant
6363
let _ = Ipv4Addr::new(CONST_U8_255, CONST_U8_255, CONST_U8_255, CONST_U8_255);
64-
//~^ ipv4v6_constant_hardcode
64+
//~^ ip_constant
6565
let _ = Ipv4Addr::new(CONST_U8_0, CONST_U8_0, CONST_U8_0, CONST_U8_0);
66-
//~^ ipv4v6_constant_hardcode
66+
//~^ ip_constant
6767

6868
use std::net::Ipv6Addr;
6969
let _ = Ipv6Addr::new(
70-
//~^ ipv4v6_constant_hardcode
70+
//~^ ip_constant
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-
//~^ ipv4v6_constant_hardcode
82+
//~^ ip_constant
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-
//~^ ipv4v6_constant_hardcode
97+
//~^ ip_constant
9898
let _ = Ipv4Addr::new(254 + CONST_U8_1, 255, { 255 - CONST_U8_0 }, CONST_U8_255);
99-
//~^ ipv4v6_constant_hardcode
99+
//~^ ip_constant
100100
let _ = Ipv4Addr::new(0, CONST_U8_255 - 255, 0, { 1 + 0 - 1 });
101-
//~^ ipv4v6_constant_hardcode
101+
//~^ ip_constant
102102

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

110110
macro_rules! ipv4_new {

0 commit comments

Comments
 (0)