PostgreSQL keeps asking for user password with "trust" authentication enabled
By checking the logs, it got apparent that PostgreSQL was matching the ::1/128 IPv6 address, which had scram-sha-256 as its authentication method. adding a line like
host    all             john            ::1/128            trust

fixed the problem.
Also, there is no need for restarting the DBMS after changes to pg_hba.conf.