It pays to be wary of politicians rushing out legislation after an accident or disaster, and the Railway Safety Act is a classic of the genre. It uses February's train derailment in East Palestine, Ohio, to enact a Big Labor priority.

The bill is courtesy of Ohio's Senate duo, Democrat Sherrod Brown and Republican J.D. Vance.

Norfolk Southern railroad is covering the more than $800 million cost to clean up the hazardous chemicals, but the senators say their bill is meant to head off future accidents.

Yet the bill's main provisions are irrelevant to the Ohio rail accident and most others. Instead it maximizes work hours for union laborers and slaps mostly redundant rules on rail carriers.

The biggest union giveaway is a mandate requiring rail carriers with more than $1.032 billion in annual revenue to maintain two-person train crews. That would mean more jobs and longer hours for rail workers, and more dues for the union, but any safety benefit is speculative. The Federal Railroad Administration declined a crew-size mandate in 2019 after finding it would have no effect on safety, and the failed Ohio train had three men aboard. Yet the 12 rail labor unions have sought it for years.

The same goes for the bill's handling of inspections. It mandates that railcars be inspected by a railroad-certified mechanic instead of a conductor, and it directs the Transportation Department to ban railroads from setting a maximum time limit for inspections. The result will be backed-up trains awaiting inspectors, but no visual check would have caught the heat failure that caused the Ohio derailment.

Sensors beat human eyeballs in detecting malfunctions, as shown in a pair of studies by consulting firm Oliver Wyman in 2015 and 2021. Rail carriers in recent years have focused on developing on-board technology for heat sensing and other common malfunctions, and the mandates will divert money that could finance future breakthroughs.

The biggest carriers already have two-man crews under their collective-bargaining agreements with the rail unions. Midsize carriers often don't, however, and they would be hit hardest by new costs. Sens. Brown and Vance rushed their bill into draft after the Ohio crash, and they seem not have considered how its rules will burden rail shipping.

Vance has said he "privately" has enough Republican support to clear the 60-vote Senate filibuster rule. But let's hope the months since the accident have given other senators time to consider the merits rather than the easy politics. Majority Leader Chuck Schumer planned to schedule a full vote after the bill cleared the Commerce Committee in May, but only seven Republicans have said they would support it. It would also face a tough hurdle in the GOP-controlled House.

Lawmakers will always be tempted to follow a crisis with new laws they can take credit for, especially when the event is close to home. Yet there's no excuse for passing an ill-considered law loaded with unnecessary priorities that cater to a political special interest.