Try this, where I changed the function to accept the second parameter which is the current post in the list table:
add_filter( 'post_row_actions', 'remove_row_actions', 10, 2 );
function remove_row_actions( $actions, $post )
{
if ( $post && 'post' === $post->post_type &&
in_array( $post->post_status, array( 'publish', 'pending' ) )
) {
unset( $actions['edit'] );
}
return $actions;
}