@@ -187,6 +187,7 @@ impl Atom {
187
187
188
188
impl Atom {
189
189
/// Get the car of the atom if it is a pair, else return the atom itself.
190
+ #[ must_use]
190
191
pub fn car ( & self ) -> Rc < Atom > {
191
192
match self {
192
193
Atom :: Pair ( car, _) => car. clone ( ) ,
@@ -195,6 +196,7 @@ impl Atom {
195
196
}
196
197
197
198
/// Get the cdr of the atom if it is a pair, else return the atom itself.
199
+ #[ must_use]
198
200
pub fn cdr ( & self ) -> Rc < Atom > {
199
201
match self {
200
202
Atom :: Pair ( _, cdr) => cdr. clone ( ) ,
@@ -220,6 +222,7 @@ impl Atom {
220
222
}
221
223
222
224
/// Returns true if the atom is nil. False otherwise
225
+ #[ must_use]
223
226
pub fn is_nil ( & self ) -> bool {
224
227
match self {
225
228
Atom :: Symbol ( sym) => sym. as_str ( ) == "nil" ,
@@ -230,6 +233,7 @@ impl Atom {
230
233
/// Return true if the atom is a proper list.
231
234
///
232
235
/// A proper list is a cons list where the last element is nil.
236
+ #[ must_use]
233
237
pub fn is_proper_list ( expr : Rc < Self > ) -> bool {
234
238
let mut expr = expr;
235
239
while !expr. is_nil ( ) {
@@ -243,6 +247,7 @@ impl Atom {
243
247
}
244
248
245
249
/// Return true if the atom is a pair.
250
+ #[ must_use]
246
251
pub fn is_list ( expr : & Rc < Self > ) -> bool {
247
252
matches ! ( expr. as_ref( ) , Atom :: Pair ( _, _) )
248
253
}
@@ -366,6 +371,7 @@ impl Atom {
366
371
}
367
372
368
373
/// Return false if the atom is nil
374
+ #[ must_use]
369
375
pub fn as_bool ( & self ) -> bool {
370
376
!self . is_nil ( )
371
377
}
@@ -396,6 +402,7 @@ impl Atom {
396
402
397
403
/// WARNING: This is probably broken, and should only be used when it doesn't matter much.
398
404
/// Currently it is used in the pretty printer, where it is used to count the lenght of a list.
405
+ #[ must_use]
399
406
pub fn into_vec ( atom : Rc < Self > ) -> Vec < Rc < Self > > {
400
407
match atom. as_ref ( ) {
401
408
Atom :: Pair ( car, cdr) => {
@@ -410,6 +417,7 @@ impl Atom {
410
417
}
411
418
412
419
/// Get length of list including sublists, or length of string if atom is a string.
420
+ #[ must_use]
413
421
pub fn get_list_lenght_including_inner ( & self ) -> usize {
414
422
match self {
415
423
Atom :: Pair ( car, cdr) => {
@@ -422,6 +430,7 @@ impl Atom {
422
430
}
423
431
424
432
/// Get length of list including sublists.
433
+ #[ must_use]
425
434
pub fn get_list_lenght_including_inner_without_symbol ( & self ) -> usize {
426
435
match self {
427
436
Atom :: Pair ( car, cdr) => {
0 commit comments