@@ -149,6 +149,7 @@ impl SocketAddr {
149
149
/// let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
150
150
/// assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));
151
151
/// ```
152
+ #[ must_use]
152
153
#[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
153
154
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
154
155
pub const fn ip ( & self ) -> IpAddr {
@@ -189,6 +190,7 @@ impl SocketAddr {
189
190
/// let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
190
191
/// assert_eq!(socket.port(), 8080);
191
192
/// ```
193
+ #[ must_use]
192
194
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
193
195
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
194
196
pub const fn port ( & self ) -> u16 {
@@ -297,6 +299,7 @@ impl SocketAddrV4 {
297
299
/// let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
298
300
/// assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1));
299
301
/// ```
302
+ #[ must_use]
300
303
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
301
304
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
302
305
pub const fn ip ( & self ) -> & Ipv4Addr {
@@ -331,6 +334,7 @@ impl SocketAddrV4 {
331
334
/// let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
332
335
/// assert_eq!(socket.port(), 8080);
333
336
/// ```
337
+ #[ must_use]
334
338
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
335
339
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
336
340
pub const fn port ( & self ) -> u16 {
@@ -396,6 +400,7 @@ impl SocketAddrV6 {
396
400
/// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
397
401
/// assert_eq!(socket.ip(), &Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
398
402
/// ```
403
+ #[ must_use]
399
404
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
400
405
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
401
406
pub const fn ip ( & self ) -> & Ipv6Addr {
@@ -428,6 +433,7 @@ impl SocketAddrV6 {
428
433
/// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
429
434
/// assert_eq!(socket.port(), 8080);
430
435
/// ```
436
+ #[ must_use]
431
437
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
432
438
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
433
439
pub const fn port ( & self ) -> u16 {
@@ -470,6 +476,7 @@ impl SocketAddrV6 {
470
476
/// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 10, 0);
471
477
/// assert_eq!(socket.flowinfo(), 10);
472
478
/// ```
479
+ #[ must_use]
473
480
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
474
481
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
475
482
pub const fn flowinfo ( & self ) -> u32 {
@@ -509,6 +516,7 @@ impl SocketAddrV6 {
509
516
/// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 78);
510
517
/// assert_eq!(socket.scope_id(), 78);
511
518
/// ```
519
+ #[ must_use]
512
520
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
513
521
#[ rustc_const_unstable( feature = "const_socketaddr" , issue = "82485" ) ]
514
522
pub const fn scope_id ( & self ) -> u32 {
0 commit comments