elfkit icon indicating copy to clipboard operation
elfkit copied to clipboard

avoid warnings in recent rust version

Open larsborn opened this issue 5 years ago • 0 comments

While tests are still passing, this patch changes the following things:

  • remove a few obsolete paranthesis
  • add a few implicit dyn keywords
  • convert a doc comment to a regular one
  • remove an obsolete semicolon

The following warnings appeared before the patch:

warning: unused doc comment
   --> src/elf.rs:606:9
    |
606 | /         ///TODO this is shitty, because we need to replicate all the alignment code
607 | |         ///also most of those sections dont actually need to be moved
    | |_____________________________________________________________________^
608 | /         for sec in &mut self.sections[1..] {
609 | |             if sec.header.addralign > 0 {
610 | |                 let oa = hoff % sec.header.addralign;
611 | |                 if oa != 0 {
...   |
614 | |             }
615 | |         }
    | |_________- rustdoc does not generate documentation for expressions
    |
    = note: `#[warn(unused_doc_comments)]` on by default

warning: unnecessary parentheses around type
   --> src/dynamic.rs:109:17
    |
109 |     ) -> Result<(usize), Error>
    |                 ^^^^^^^ help: remove these parentheses
    |
    = note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around type
   --> src/elf.rs:682:59
    |
682 |     pub fn remove_section(&mut self, at: usize) -> Result<(Section), Error> {
    |                                                           ^^^^^^^^^ help: remove these parentheses

warning: trait objects without an explicit `dyn` are deprecated
  --> src/loader.rs:39:30
   |
39 |         read:    RefCell<Box<ReadSeekSend>>,
   |                              ^^^^^^^^^^^^ help: use `dyn`: `dyn ReadSeekSend`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
   --> src/loader.rs:233:50
    |
233 |     fn make_object(name: String, io: RefCell<Box<ReadSeekSend>>) -> Result<State, Error> {
    |                                                  ^^^^^^^^^^^^ help: use `dyn`: `dyn ReadSeekSend`

warning: unnecessary parentheses around type
   --> src/relocation.rs:180:17
    |
180 |     ) -> Result<(usize), Error>
    |                 ^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around type
   --> src/symbol.rs:173:17
    |
173 |     ) -> Result<(usize), Error>
    |                 ^^^^^^^ help: remove these parentheses

warning: unnecessary trailing semicolon
   --> bin/ld.rs:627:91
    |
627 |             .find(|&(_,s)|s.bind == types::SymbolBind::GLOBAL).map(|(i,_)|i).unwrap_or(0);;
    |                                                                                           ^ help: remove this semicolon
    |
    = note: `#[warn(redundant_semicolon)]` on by default

    Finished release [optimized] target(s) in 0.03s 

larsborn avatar Dec 25 '19 13:12 larsborn