File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to
1010
1111-  cosmwasm-std: Add an IBC querier implementation to ` testing::MockQuerier ` 
1212  ([ #1620  ] , [ #1624  ] ).
13+ -  cosmwasm-std: Add ` #[must_use] `  annotations to ` Timestamp `  math functions.
1314
1415[ #1620 ] : https://github.com/CosmWasm/cosmwasm/pull/1620 
1516[ #1624 ] : https://github.com/CosmWasm/cosmwasm/pull/1624 
Original file line number Diff line number Diff line change @@ -38,19 +38,23 @@ impl Timestamp {
3838        Timestamp ( Uint64 :: new ( seconds_since_epoch *  1_000_000_000 ) ) 
3939    } 
4040
41+     #[ must_use = "this returns the result of the operation, without modifying the original" ]  
4142    pub  const  fn  plus_seconds ( & self ,  addition :  u64 )  -> Timestamp  { 
4243        self . plus_nanos ( addition *  1_000_000_000 ) 
4344    } 
4445
46+     #[ must_use = "this returns the result of the operation, without modifying the original" ]  
4547    pub  const  fn  plus_nanos ( & self ,  addition :  u64 )  -> Timestamp  { 
4648        let  nanos = Uint64 :: new ( self . 0 . u64 ( )  + addition) ; 
4749        Timestamp ( nanos) 
4850    } 
4951
52+     #[ must_use = "this returns the result of the operation, without modifying the original" ]  
5053    pub  const  fn  minus_seconds ( & self ,  subtrahend :  u64 )  -> Timestamp  { 
5154        self . minus_nanos ( subtrahend *  1_000_000_000 ) 
5255    } 
5356
57+     #[ must_use = "this returns the result of the operation, without modifying the original" ]  
5458    pub  const  fn  minus_nanos ( & self ,  subtrahend :  u64 )  -> Timestamp  { 
5559        let  nanos = Uint64 :: new ( self . 0 . u64 ( )  - subtrahend) ; 
5660        Timestamp ( nanos) 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments