Electron inertia and small-scale magnetic structures in a nonuniform collisionless plasma