In “The Nice Guys,” a smashingly disreputable mystery-comedy free-for-all directed with a wink of trashy zest by Shane Black, Russell Crowe plays a freelance thug for hire — the sort of guy who will keep your teenage daughter from dating a druggie sleazebag by paying a visit to the sleazebag’s house and bashing him in the face with brass knuckles. (It’s amazing how effective that is.) The films tosses Crowe together with a sweetly shambling private detective, played by Ryan Gosling, who’s as earnest and inept as his new partner is brusquely violent. It’s 1977, and these two cruise around Los Angeles against a backdrop of polyester boogie-nights tackiness, busting heads, crashing parties, fleeing hit men, and getting to the dirty bottom of a conspiracy that somehow combines the adult-film underworld with a scheme by the Big Three automakers to suppress the catalytic converter. (Yes, it’s a PC message movie gone flesh.) “The Nice Guys” is an ultra-violent burlesque, the sort of cheerfully hostile buddy bash that’s been a staple since the ’80s, only this one is singularly clever about its own triviality, and it offers the scruffy pleasure of seeing two great actors dial down their gravitas with style. The movie is likely to score big with audiences, and for the same reason that it’s proven to be a perfect palate cleanser at Cannes. It’s a treat to see popcorn this decadent made by people who know exactly what they’re doing.

The modern buddy comedy originally kicked off with “Butch Cassidy and the Sundance Kid,” but the screenwriter who juiced it up into its current knockabout voltage is Shane Black, when he wrote “Lethal Weapon” in 1987. The way that movie mashed together fireball action, racially barbed insult comedy, and a general atmosphere of what-the-hell insanity made it one of the most influential throwaways of the ’80s, though part of its appeal is that Black, with his gift for jabbing cutthroat patter, seemed to be glorying in the notion that he wasn’t aiming very high. After penning the first “Lethal Weapon” sequel, he reinvented himself by writing and directing “Kiss Kiss Bang Bang” (2005), an off-the-wall crime thriller that was a little precious in its zingy bon mots — but you could see that Black was trying for something. Then, after a break of close to 10 years, he directed “Iron Man 3” and became a superb pop filmmaker, deepening the saga of Tony Stark with a blend of spectacle and dread that turned it into one of the most supple Marvel movies ever made. “The Nice Guys” is like a “Lethal Weapon” film made by the far wittier and more dexterous Shane Black of “Iron Man 3.” The film keeps surprising you, so that you never feel you’re watching a fists-meets-yocks-meets-corruption formula (even when you are).

At a certain point, you may gawk at a Hollywood leading man and think that he’s looking a little chunky, a little jowly, a little used. Then there’s the point when that actor has carried his used aura for so long that he starts letting it define him; he begins to use it himself. That’s where Russell Crowe is at in “The Nice Guys.” His Jackson Healy, squinty and rotund in a dirty light blue leather jacket, with hair combed back into a DA, is sort of like a loan-shark goon, except that he doesn’t work for the Mob. He’ll work for anyone who can scrape together a few lousy bucks. What’s fun about watching him is that he treats the savagery of his job as casually as if he were filling out a tax form. Crowe, deftly exploiting the irony of the film’s title, makes Jackson a courtly bruiser, a guy who will beat the crap out of anyone — but only as a means to an end. (The fact that he might enjoy it is deeply buried subtext.) Early on, he’s assigned to pay a visit to Holland March (Gosling) to take him off a case. He snaps his wrist in two — which, in this movie, is the equivalent of a handshake. Sure enough, the two are soon working together, assigned to locate Amelia (Margaret Qualley), a barefoot brunette in a yellow dress who keeps popping up like an apparition. She starred in her boyfriend’s “experimental” – that is, naked — movie, and then his house burned down, and a vicious thug named John Boy (Matt Bomer, in creepy bangs) is desperate to get hold of the movie. But why?

At first, Holland stares at his partner with a glint of farcical terror. Gosling, among his many talents, has blossomed into an inspired physical comedian, and it’s a hoot to watch him converse with Crowe from a bathroom stall as he tries to fumblingly prop open the door, point a gun, and hold a magazine over his junk at the same time. But Holland is most funny when parading his self-schooled cluelessness. He’s naturally blitzed, usually drunk, and myopically sincere, as when he confronts a reckless cop who says that he was carrying out his orders by righteously proclaiming, “You know who else was just following orders? Hitler!” Gosling invests that line with so much conviction that we can’t help but notice that Holland got it half-right, and that it’s almost touching in its hilarity.

For a movie set in the late ’70s, “The Nice Guys” has a great deal of spangly, smog-drenched atmosphere — Philippe Rousselot’s cinematography gives L.A. a night-bloom glow — but not, in the end, a lot of period authenticity. Earth, Wind & Fire, portrayed by actors, perform at a party hosted by a porn producer, but why, only minutes before, do we hear EWF’s “Boogie Wonderland” on the soundtrack — a song that didn’t come out until two years later? Holland dresses in swirly psychedelic shirts, and there are references to the novelty of no-fault divorce, but these are token signifiers that never add up to the loosey-goosey stoned sleaze of the ’70s.

Then again, what’s fun about “The Nice Guys” is that its casually remorseless hostility, reflected in everything from the drop-dead wisecracks to the slapstick cruelty of its violence, expresses nothing so much as the spirit of today. There’s a great moment when our heroes have ridden up a hotel elevator to ambush a villain, and as the elevator door opens we see a body clawing the corridor wall, then another one being shot, and our heroes duck back into the elevator, with a “We don’t need this” shrug. The timing of the gag is exquisite, because it’s Black’s way of expressing what it feels like when whatever you’re expecting is almost certain to turn out worse. In “The Nice Guys,” the cynical moxie that was just a mayhem-fueled joke in the “Lethal Weapon” films here gets pushed into something a shade more resonant — a comedy of resigned aggression, where everyone is trolling everyone else.