1

The compiler tells me that vvp_i_name and vvp_j_name match any value, but I can't figure out why.

vvp_i_name and vvp_j_name are type i32, con.parm is type std::vec::Vec<i32>.

fn check(vvp_i: (Variable, i32), vvp_j: (Variable, i32), cc: &mut i32, csp: CSP) -> bool {
    if vvp_i.0.neighbors.contains_key(&vvp_j.0.name) {
        *cc += 1;
        for x in vvp_i.0.neighbors.get(&vvp_j.0.name).unwrap() {
            let con = csp.constraints.get(x).unwrap();
            match con.mode {
                Mode::Extension(ExtensionType::Supports) => {
                                        if !con.tuples.contains(&(vvp_i.1, vvp_j.1)) {return false} //We can't return true till we cycle
                                    }                                                               //through the entire for loop.
                Mode::Extension(ExtensionType::Conflicts) => {                                      //
                                        if con.tuples.contains(&(vvp_i.1, vvp_j.1)) {return false}  //
                                    }
                Mode::Intension => {
                                        let vvp_i_name = vvp_i.0.name;
                                        let vvp_j_name = vvp_j.0.name;
                                        for y in con.parm {
                                            match y {
                                                vvp_i_name => {/*...Do stuff...*/}
                                                vvp_j_name => {/*...Do stuff...*/}
                                                _ => {}
                                            }
                                        }
                                    }
            }
        }
    }
    true
}
Lukas Kalbertodt
  • 79,749
  • 26
  • 255
  • 305
HiDefender
  • 2,088
  • 2
  • 14
  • 31
  • 2
    Welcome to StackOverflow, HiDefender! You can find the answer to your question in the linked question which yours is a dupe of. Some tips for your next question: provide a [MCVE]. Since everyone here loves questions with MCVEs, you will get an answer way quicker! It's also a good idea to read ["How to ask?"](http://stackoverflow.com/help/how-to-ask) again. That's all I wanted to say. I hope you're having fun with Rust and our small SO-community! – Lukas Kalbertodt Sep 26 '16 at 16:45

0 Answers0