@@ -83,10 +83,6 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts {
83
83
if name. as_str( ) == "account" ;
84
84
if let MacArgs :: Delimited ( _, _, token_stream) = & attr_item. args;
85
85
then {
86
- // Parse each constraint as a separate TokenStream
87
- // for delimited_stream in split(token_stream.trees(), TokenKind::Comma) {
88
- // self.streams.0.push(delimited_stream);
89
- // }
90
86
self . streams. 0 . push( token_stream. clone( ) ) ;
91
87
}
92
88
}
@@ -107,13 +103,11 @@ impl<'tcx> LateLintPass<'tcx> for DuplicateMutableAccounts {
107
103
if !( self . streams . contains ( & stream)
108
104
|| self . streams . contains ( & symmetric_stream) )
109
105
{
110
- // NOTE: for some reason, will only print out 2 messages, not 3
111
- // println!("spanning lint");
112
106
span_lint_and_help (
113
107
cx,
114
108
DUPLICATE_MUTABLE_ACCOUNTS ,
115
109
first_span,
116
- " identical account types without a key check constraint",
110
+ & format ! ( "{} and {} have identical account types but do not have a key check constraint", first , other ) ,
117
111
Some ( * other_span) ,
118
112
& format ! ( "add an anchor key check constraint: #[account(constraint = {}.key() != {}.key())]" , first, other)
119
113
) ;
@@ -212,7 +206,6 @@ impl Streams {
212
206
for ( j, other_token) in other. trees ( ) . enumerate ( ) {
213
207
match stream. trees ( ) . nth ( i + j) {
214
208
Some ( token_tree) => {
215
- // println!("Comparing {:#?} with {:#?}", token_tree, other_tokens[j]);
216
209
if !token_tree. eq_unspanned ( other_token) {
217
210
break ;
218
211
}
@@ -229,24 +222,6 @@ impl Streams {
229
222
}
230
223
}
231
224
232
- // /// Splits `stream` into a vector of substreams, separated by `delimiter`.
233
- // fn split(stream: CursorRef, delimiter: TokenKind) -> Vec<TokenStream> {
234
- // let mut split_streams: Vec<TokenStream> = Vec::new();
235
- // let mut temp: Vec<TreeAndSpacing> = Vec::new();
236
- // let delim = TokenTree::Token(Token::new(delimiter, DUMMY_SP));
237
-
238
- // stream.for_each(|t| {
239
- // if t.eq_unspanned(&delim) {
240
- // split_streams.push(TokenStream::new(temp.clone()));
241
- // temp.clear();
242
- // } else {
243
- // temp.push(TreeAndSpacing::from(t.clone()));
244
- // }
245
- // });
246
- // split_streams.push(TokenStream::new(temp));
247
- // split_streams
248
- // }
249
-
250
225
#[ test]
251
226
fn insecure ( ) {
252
227
dylint_testing:: ui_test_example ( env ! ( "CARGO_PKG_NAME" ) , "insecure" ) ;
0 commit comments