Guys confuse me lol

So, my boyfriends best friend said that he would beat my boyfriends ass if he ever cheated on me. I’m just confused as to why he would say that? Isn’t that breaking guy code?